Supported GetVideo Api.

This commit is contained in:
sdk-team
2023-05-09 06:23:33 +00:00
parent 580d4c3b54
commit 12839600df
8 changed files with 276 additions and 1 deletions

View File

@@ -2319,6 +2319,42 @@ CCCClient::GetUserOutcomeCallable CCCClient::getUserCallable(const GetUserReques
return task->get_future();
}
CCCClient::GetVideoOutcome CCCClient::getVideo(const GetVideoRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return GetVideoOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return GetVideoOutcome(GetVideoResult(outcome.result()));
else
return GetVideoOutcome(outcome.error());
}
void CCCClient::getVideoAsync(const GetVideoRequest& request, const GetVideoAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, getVideo(request), context);
};
asyncExecute(new Runnable(fn));
}
CCCClient::GetVideoOutcomeCallable CCCClient::getVideoCallable(const GetVideoRequest &request) const
{
auto task = std::make_shared<std::packaged_task<GetVideoOutcome()>>(
[this, request]()
{
return this->getVideo(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
CCCClient::GetVoicemailRecordingOutcome CCCClient::getVoicemailRecording(const GetVoicemailRecordingRequest &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/ccc/model/GetVideoRequest.h>
using AlibabaCloud::CCC::Model::GetVideoRequest;
GetVideoRequest::GetVideoRequest()
: RpcServiceRequest("ccc", "2020-07-01", "GetVideo") {
setMethod(HttpRequest::Method::Get);
}
GetVideoRequest::~GetVideoRequest() {}
std::string GetVideoRequest::getContactId() const {
return contactId_;
}
void GetVideoRequest::setContactId(const std::string &contactId) {
contactId_ = contactId;
setParameter(std::string("ContactId"), contactId);
}
std::string GetVideoRequest::getInstanceId() const {
return instanceId_;
}
void GetVideoRequest::setInstanceId(const std::string &instanceId) {
instanceId_ = instanceId;
setParameter(std::string("InstanceId"), instanceId);
}

View File

@@ -0,0 +1,75 @@
/*
* 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/ccc/model/GetVideoResult.h>
#include <json/json.h>
using namespace AlibabaCloud::CCC;
using namespace AlibabaCloud::CCC::Model;
GetVideoResult::GetVideoResult() :
ServiceResult()
{}
GetVideoResult::GetVideoResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
GetVideoResult::~GetVideoResult()
{}
void GetVideoResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
if(!dataNode["FileUrl"].isNull())
data_.fileUrl = dataNode["FileUrl"].asString();
if(!dataNode["FileName"].isNull())
data_.fileName = dataNode["FileName"].asString();
if(!value["Code"].isNull())
code_ = value["Code"].asString();
if(!value["HttpStatusCode"].isNull())
httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
if(!value["Message"].isNull())
message_ = value["Message"].asString();
}
std::string GetVideoResult::getMessage()const
{
return message_;
}
int GetVideoResult::getHttpStatusCode()const
{
return httpStatusCode_;
}
GetVideoResult::Data GetVideoResult::getData()const
{
return data_;
}
std::string GetVideoResult::getCode()const
{
return code_;
}