Supported GetOfficePreviewURL.

This commit is contained in:
sdk-team
2020-02-05 19:48:27 +08:00
parent b353656f13
commit 09607080ce
13 changed files with 348 additions and 15 deletions

View File

@@ -2427,6 +2427,42 @@ ImmClient::PutProjectOutcomeCallable ImmClient::putProjectCallable(const PutProj
return task->get_future();
}
ImmClient::RefreshOfficePreviewTokenOutcome ImmClient::refreshOfficePreviewToken(const RefreshOfficePreviewTokenRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RefreshOfficePreviewTokenOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RefreshOfficePreviewTokenOutcome(RefreshOfficePreviewTokenResult(outcome.result()));
else
return RefreshOfficePreviewTokenOutcome(outcome.error());
}
void ImmClient::refreshOfficePreviewTokenAsync(const RefreshOfficePreviewTokenRequest& request, const RefreshOfficePreviewTokenAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, refreshOfficePreviewToken(request), context);
};
asyncExecute(new Runnable(fn));
}
ImmClient::RefreshOfficePreviewTokenOutcomeCallable ImmClient::refreshOfficePreviewTokenCallable(const RefreshOfficePreviewTokenRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RefreshOfficePreviewTokenOutcome()>>(
[this, request]()
{
return this->refreshOfficePreviewToken(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
ImmClient::SearchDocIndexOutcome ImmClient::searchDocIndex(const SearchDocIndexRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();

View File

@@ -38,17 +38,6 @@ void GetOfficePreviewURLRequest::setSrcType(const std::string& srcType)
setCoreParameter("SrcType", srcType);
}
int GetOfficePreviewURLRequest::getExpires()const
{
return expires_;
}
void GetOfficePreviewURLRequest::setExpires(int expires)
{
expires_ = expires;
setCoreParameter("Expires", std::to_string(expires));
}
std::string GetOfficePreviewURLRequest::getProject()const
{
return project_;

View File

@@ -41,6 +41,14 @@ void GetOfficePreviewURLResult::parse(const std::string &payload)
setRequestId(value["RequestId"].asString());
if(!value["PreviewURL"].isNull())
previewURL_ = value["PreviewURL"].asString();
if(!value["AccessToken"].isNull())
accessToken_ = value["AccessToken"].asString();
if(!value["RefreshToken"].isNull())
refreshToken_ = value["RefreshToken"].asString();
if(!value["AccessTokenExpiredTime"].isNull())
accessTokenExpiredTime_ = value["AccessTokenExpiredTime"].asString();
if(!value["RefreshTokenExpiredTime"].isNull())
refreshTokenExpiredTime_ = value["RefreshTokenExpiredTime"].asString();
}
@@ -49,3 +57,23 @@ std::string GetOfficePreviewURLResult::getPreviewURL()const
return previewURL_;
}
std::string GetOfficePreviewURLResult::getRefreshToken()const
{
return refreshToken_;
}
std::string GetOfficePreviewURLResult::getAccessToken()const
{
return accessToken_;
}
std::string GetOfficePreviewURLResult::getRefreshTokenExpiredTime()const
{
return refreshTokenExpiredTime_;
}
std::string GetOfficePreviewURLResult::getAccessTokenExpiredTime()const
{
return accessTokenExpiredTime_;
}

View File

@@ -0,0 +1,73 @@
/*
* 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/imm/model/RefreshOfficePreviewTokenRequest.h>
using AlibabaCloud::Imm::Model::RefreshOfficePreviewTokenRequest;
RefreshOfficePreviewTokenRequest::RefreshOfficePreviewTokenRequest() :
RpcServiceRequest("imm", "2017-09-06", "RefreshOfficePreviewToken")
{
setMethod(HttpRequest::Method::Post);
}
RefreshOfficePreviewTokenRequest::~RefreshOfficePreviewTokenRequest()
{}
std::string RefreshOfficePreviewTokenRequest::getProject()const
{
return project_;
}
void RefreshOfficePreviewTokenRequest::setProject(const std::string& project)
{
project_ = project;
setCoreParameter("Project", project);
}
std::string RefreshOfficePreviewTokenRequest::getAccessToken()const
{
return accessToken_;
}
void RefreshOfficePreviewTokenRequest::setAccessToken(const std::string& accessToken)
{
accessToken_ = accessToken;
setCoreParameter("AccessToken", accessToken);
}
std::string RefreshOfficePreviewTokenRequest::getAccessKeyId()const
{
return accessKeyId_;
}
void RefreshOfficePreviewTokenRequest::setAccessKeyId(const std::string& accessKeyId)
{
accessKeyId_ = accessKeyId;
setCoreParameter("AccessKeyId", accessKeyId);
}
std::string RefreshOfficePreviewTokenRequest::getRefreshToken()const
{
return refreshToken_;
}
void RefreshOfficePreviewTokenRequest::setRefreshToken(const std::string& refreshToken)
{
refreshToken_ = refreshToken;
setCoreParameter("RefreshToken", refreshToken);
}

View File

@@ -0,0 +1,72 @@
/*
* 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/imm/model/RefreshOfficePreviewTokenResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Imm;
using namespace AlibabaCloud::Imm::Model;
RefreshOfficePreviewTokenResult::RefreshOfficePreviewTokenResult() :
ServiceResult()
{}
RefreshOfficePreviewTokenResult::RefreshOfficePreviewTokenResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RefreshOfficePreviewTokenResult::~RefreshOfficePreviewTokenResult()
{}
void RefreshOfficePreviewTokenResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
if(!value["AccessToken"].isNull())
accessToken_ = value["AccessToken"].asString();
if(!value["AccessTokenExpiredTime"].isNull())
accessTokenExpiredTime_ = value["AccessTokenExpiredTime"].asString();
if(!value["RefreshToken"].isNull())
refreshToken_ = value["RefreshToken"].asString();
if(!value["RefreshTokenExpiredTime"].isNull())
refreshTokenExpiredTime_ = value["RefreshTokenExpiredTime"].asString();
}
std::string RefreshOfficePreviewTokenResult::getRefreshToken()const
{
return refreshToken_;
}
std::string RefreshOfficePreviewTokenResult::getAccessToken()const
{
return accessToken_;
}
std::string RefreshOfficePreviewTokenResult::getRefreshTokenExpiredTime()const
{
return refreshTokenExpiredTime_;
}
std::string RefreshOfficePreviewTokenResult::getAccessTokenExpiredTime()const
{
return accessTokenExpiredTime_;
}