SDK.
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
2022-02-23 Version: 1.36.1067
|
||||
- SDK.
|
||||
|
||||
2022-02-23 Version: 1.36.1066
|
||||
- Add AuthId.
|
||||
|
||||
|
||||
90
cloudauth-console/CMakeLists.txt
Normal file
90
cloudauth-console/CMakeLists.txt
Normal file
@@ -0,0 +1,90 @@
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
|
||||
|
||||
set(cloudauth-console_public_header
|
||||
include/alibabacloud/cloudauth-console/Cloudauth_consoleClient.h
|
||||
include/alibabacloud/cloudauth-console/Cloudauth_consoleExport.h )
|
||||
|
||||
set(cloudauth-console_public_header_model
|
||||
include/alibabacloud/cloudauth-console/model/RetrieveFaceRequest.h
|
||||
include/alibabacloud/cloudauth-console/model/RetrieveFaceResult.h
|
||||
include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordRequest.h
|
||||
include/alibabacloud/cloudauth-console/model/UploadIdentifyRecordResult.h )
|
||||
|
||||
set(cloudauth-console_src
|
||||
src/Cloudauth-consoleClient.cc
|
||||
src/model/RetrieveFaceRequest.cc
|
||||
src/model/RetrieveFaceResult.cc
|
||||
src/model/UploadIdentifyRecordRequest.cc
|
||||
src/model/UploadIdentifyRecordResult.cc )
|
||||
|
||||
add_library(cloudauth-console ${LIB_TYPE}
|
||||
${cloudauth-console_public_header}
|
||||
${cloudauth-console_public_header_model}
|
||||
${cloudauth-console_src})
|
||||
|
||||
set_target_properties(cloudauth-console
|
||||
PROPERTIES
|
||||
LINKER_LANGUAGE CXX
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
|
||||
RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
|
||||
OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}cloudauth-console
|
||||
)
|
||||
|
||||
if(${LIB_TYPE} STREQUAL "SHARED")
|
||||
set_target_properties(cloudauth-console
|
||||
PROPERTIES
|
||||
DEFINE_SYMBOL ALIBABACLOUD_CLOUDAUTH_CONSOLE_LIBRARY)
|
||||
endif()
|
||||
|
||||
target_include_directories(cloudauth-console
|
||||
PRIVATE include
|
||||
${CMAKE_SOURCE_DIR}/core/include
|
||||
)
|
||||
target_link_libraries(cloudauth-console
|
||||
core)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
|
||||
set(jsoncpp_install_dir ${INSTALL_DIR})
|
||||
add_dependencies(cloudauth-console
|
||||
jsoncpp)
|
||||
target_include_directories(cloudauth-console
|
||||
PRIVATE ${jsoncpp_install_dir}/include)
|
||||
target_link_libraries(cloudauth-console
|
||||
${jsoncpp_install_dir}/lib/jsoncpp.lib)
|
||||
set_target_properties(cloudauth-console
|
||||
PROPERTIES
|
||||
COMPILE_OPTIONS "/bigobj")
|
||||
else()
|
||||
target_include_directories(cloudauth-console
|
||||
PRIVATE /usr/include/jsoncpp)
|
||||
target_link_libraries(cloudauth-console
|
||||
jsoncpp)
|
||||
endif()
|
||||
|
||||
install(FILES ${cloudauth-console_public_header}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudauth-console)
|
||||
install(FILES ${cloudauth-console_public_header_model}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/cloudauth-console/model)
|
||||
install(TARGETS cloudauth-console
|
||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLECLIENT_H_
|
||||
#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLECLIENT_H_
|
||||
|
||||
#include <future>
|
||||
#include <alibabacloud/core/AsyncCallerContext.h>
|
||||
#include <alibabacloud/core/EndpointProvider.h>
|
||||
#include <alibabacloud/core/RpcServiceClient.h>
|
||||
#include "Cloudauth_consoleExport.h"
|
||||
#include "model/RetrieveFaceRequest.h"
|
||||
#include "model/RetrieveFaceResult.h"
|
||||
#include "model/UploadIdentifyRecordRequest.h"
|
||||
#include "model/UploadIdentifyRecordResult.h"
|
||||
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cloudauth_console
|
||||
{
|
||||
class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT Cloudauth_consoleClient : public RpcServiceClient
|
||||
{
|
||||
public:
|
||||
typedef Outcome<Error, Model::RetrieveFaceResult> RetrieveFaceOutcome;
|
||||
typedef std::future<RetrieveFaceOutcome> RetrieveFaceOutcomeCallable;
|
||||
typedef std::function<void(const Cloudauth_consoleClient*, const Model::RetrieveFaceRequest&, const RetrieveFaceOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RetrieveFaceAsyncHandler;
|
||||
typedef Outcome<Error, Model::UploadIdentifyRecordResult> UploadIdentifyRecordOutcome;
|
||||
typedef std::future<UploadIdentifyRecordOutcome> UploadIdentifyRecordOutcomeCallable;
|
||||
typedef std::function<void(const Cloudauth_consoleClient*, const Model::UploadIdentifyRecordRequest&, const UploadIdentifyRecordOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> UploadIdentifyRecordAsyncHandler;
|
||||
|
||||
Cloudauth_consoleClient(const Credentials &credentials, const ClientConfiguration &configuration);
|
||||
Cloudauth_consoleClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
|
||||
Cloudauth_consoleClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
|
||||
~Cloudauth_consoleClient();
|
||||
RetrieveFaceOutcome retrieveFace(const Model::RetrieveFaceRequest &request)const;
|
||||
void retrieveFaceAsync(const Model::RetrieveFaceRequest& request, const RetrieveFaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
RetrieveFaceOutcomeCallable retrieveFaceCallable(const Model::RetrieveFaceRequest& request) const;
|
||||
UploadIdentifyRecordOutcome uploadIdentifyRecord(const Model::UploadIdentifyRecordRequest &request)const;
|
||||
void uploadIdentifyRecordAsync(const Model::UploadIdentifyRecordRequest& request, const UploadIdentifyRecordAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
|
||||
UploadIdentifyRecordOutcomeCallable uploadIdentifyRecordCallable(const Model::UploadIdentifyRecordRequest& request) const;
|
||||
|
||||
private:
|
||||
std::shared_ptr<EndpointProvider> endpointProvider_;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLECLIENT_H_
|
||||
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLEEXPORT_H_
|
||||
#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLEEXPORT_H_
|
||||
|
||||
#include <alibabacloud/core/Global.h>
|
||||
|
||||
#if defined(ALIBABACLOUD_SHARED)
|
||||
# if defined(ALIBABACLOUD_CLOUDAUTH_CONSOLE_LIBRARY)
|
||||
# define ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT ALIBABACLOUD_DECL_EXPORT
|
||||
# else
|
||||
# define ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT ALIBABACLOUD_DECL_IMPORT
|
||||
# endif
|
||||
#else
|
||||
# define ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT
|
||||
#endif
|
||||
|
||||
#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_CLOUDAUTH_CONSOLEEXPORT_H_
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACEREQUEST_H_
|
||||
#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACEREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/cloudauth-console/Cloudauth_consoleExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cloudauth_console
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT RetrieveFaceRequest : public RpcServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
RetrieveFaceRequest();
|
||||
~RetrieveFaceRequest();
|
||||
|
||||
std::string getFace64String()const;
|
||||
void setFace64String(const std::string& face64String);
|
||||
std::string getFaceUrl()const;
|
||||
void setFaceUrl(const std::string& faceUrl);
|
||||
std::string getProjectId()const;
|
||||
void setProjectId(const std::string& projectId);
|
||||
|
||||
private:
|
||||
std::string face64String_;
|
||||
std::string faceUrl_;
|
||||
std::string projectId_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACEREQUEST_H_
|
||||
@@ -0,0 +1,59 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACERESULT_H_
|
||||
#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACERESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/cloudauth-console/Cloudauth_consoleExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cloudauth_console
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT RetrieveFaceResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
struct DataItem
|
||||
{
|
||||
std::string userName;
|
||||
long userId;
|
||||
std::string rate;
|
||||
};
|
||||
|
||||
|
||||
RetrieveFaceResult();
|
||||
explicit RetrieveFaceResult(const std::string &payload);
|
||||
~RetrieveFaceResult();
|
||||
std::vector<DataItem> getData()const;
|
||||
bool getSuccess()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
std::vector<DataItem> data_;
|
||||
bool success_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_RETRIEVEFACERESULT_H_
|
||||
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDREQUEST_H_
|
||||
#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDREQUEST_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <alibabacloud/core/RpcServiceRequest.h>
|
||||
#include <alibabacloud/cloudauth-console/Cloudauth_consoleExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cloudauth_console
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT UploadIdentifyRecordRequest : public RpcServiceRequest
|
||||
{
|
||||
|
||||
public:
|
||||
UploadIdentifyRecordRequest();
|
||||
~UploadIdentifyRecordRequest();
|
||||
|
||||
std::string getExt()const;
|
||||
void setExt(const std::string& ext);
|
||||
std::string getIdentifyingImageUrl()const;
|
||||
void setIdentifyingImageUrl(const std::string& identifyingImageUrl);
|
||||
std::string getIdentifyingImageBase64()const;
|
||||
void setIdentifyingImageBase64(const std::string& identifyingImageBase64);
|
||||
std::string getDeviceSecret()const;
|
||||
void setDeviceSecret(const std::string& deviceSecret);
|
||||
std::string getProductKey()const;
|
||||
void setProductKey(const std::string& productKey);
|
||||
std::string getUserId()const;
|
||||
void setUserId(const std::string& userId);
|
||||
std::string getIotId()const;
|
||||
void setIotId(const std::string& iotId);
|
||||
std::string getDeviceName()const;
|
||||
void setDeviceName(const std::string& deviceName);
|
||||
long getIdentifyingTime()const;
|
||||
void setIdentifyingTime(long identifyingTime);
|
||||
std::string getProjectId()const;
|
||||
void setProjectId(const std::string& projectId);
|
||||
std::string getUserName()const;
|
||||
void setUserName(const std::string& userName);
|
||||
|
||||
private:
|
||||
std::string ext_;
|
||||
std::string identifyingImageUrl_;
|
||||
std::string identifyingImageBase64_;
|
||||
std::string deviceSecret_;
|
||||
std::string productKey_;
|
||||
std::string userId_;
|
||||
std::string iotId_;
|
||||
std::string deviceName_;
|
||||
long identifyingTime_;
|
||||
std::string projectId_;
|
||||
std::string userName_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDREQUEST_H_
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDRESULT_H_
|
||||
#define ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDRESULT_H_
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
#include <alibabacloud/core/ServiceResult.h>
|
||||
#include <alibabacloud/cloudauth-console/Cloudauth_consoleExport.h>
|
||||
|
||||
namespace AlibabaCloud
|
||||
{
|
||||
namespace Cloudauth_console
|
||||
{
|
||||
namespace Model
|
||||
{
|
||||
class ALIBABACLOUD_CLOUDAUTH_CONSOLE_EXPORT UploadIdentifyRecordResult : public ServiceResult
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
UploadIdentifyRecordResult();
|
||||
explicit UploadIdentifyRecordResult(const std::string &payload);
|
||||
~UploadIdentifyRecordResult();
|
||||
int getHttpStatusCode()const;
|
||||
bool getSuccess()const;
|
||||
|
||||
protected:
|
||||
void parse(const std::string &payload);
|
||||
private:
|
||||
int httpStatusCode_;
|
||||
bool success_;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // !ALIBABACLOUD_CLOUDAUTH_CONSOLE_MODEL_UPLOADIDENTIFYRECORDRESULT_H_
|
||||
125
cloudauth-console/src/Cloudauth-consoleClient.cc
Normal file
125
cloudauth-console/src/Cloudauth-consoleClient.cc
Normal file
@@ -0,0 +1,125 @@
|
||||
/*
|
||||
* 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/cloudauth-console/Cloudauth_consoleClient.h>
|
||||
#include <alibabacloud/core/SimpleCredentialsProvider.h>
|
||||
|
||||
using namespace AlibabaCloud;
|
||||
using namespace AlibabaCloud::Location;
|
||||
using namespace AlibabaCloud::Cloudauth_console;
|
||||
using namespace AlibabaCloud::Cloudauth_console::Model;
|
||||
|
||||
namespace
|
||||
{
|
||||
const std::string SERVICE_NAME = "Cloudauth-console";
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::Cloudauth_consoleClient(const Credentials &credentials, const ClientConfiguration &configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(credentials), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentials, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "cloudauth-console");
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::Cloudauth_consoleClient(const std::shared_ptr<CredentialsProvider>& credentialsProvider, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, credentialsProvider, configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(credentialsProvider, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "cloudauth-console");
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::Cloudauth_consoleClient(const std::string & accessKeyId, const std::string & accessKeySecret, const ClientConfiguration & configuration) :
|
||||
RpcServiceClient(SERVICE_NAME, std::make_shared<SimpleCredentialsProvider>(accessKeyId, accessKeySecret), configuration)
|
||||
{
|
||||
auto locationClient = std::make_shared<LocationClient>(accessKeyId, accessKeySecret, configuration);
|
||||
endpointProvider_ = std::make_shared<EndpointProvider>(locationClient, configuration.regionId(), SERVICE_NAME, "cloudauth-console");
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::~Cloudauth_consoleClient()
|
||||
{}
|
||||
|
||||
Cloudauth_consoleClient::RetrieveFaceOutcome Cloudauth_consoleClient::retrieveFace(const RetrieveFaceRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return RetrieveFaceOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return RetrieveFaceOutcome(RetrieveFaceResult(outcome.result()));
|
||||
else
|
||||
return RetrieveFaceOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void Cloudauth_consoleClient::retrieveFaceAsync(const RetrieveFaceRequest& request, const RetrieveFaceAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, retrieveFace(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::RetrieveFaceOutcomeCallable Cloudauth_consoleClient::retrieveFaceCallable(const RetrieveFaceRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<RetrieveFaceOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->retrieveFace(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::UploadIdentifyRecordOutcome Cloudauth_consoleClient::uploadIdentifyRecord(const UploadIdentifyRecordRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return UploadIdentifyRecordOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return UploadIdentifyRecordOutcome(UploadIdentifyRecordResult(outcome.result()));
|
||||
else
|
||||
return UploadIdentifyRecordOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void Cloudauth_consoleClient::uploadIdentifyRecordAsync(const UploadIdentifyRecordRequest& request, const UploadIdentifyRecordAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, uploadIdentifyRecord(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
Cloudauth_consoleClient::UploadIdentifyRecordOutcomeCallable Cloudauth_consoleClient::uploadIdentifyRecordCallable(const UploadIdentifyRecordRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<UploadIdentifyRecordOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->uploadIdentifyRecord(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
62
cloudauth-console/src/model/RetrieveFaceRequest.cc
Normal file
62
cloudauth-console/src/model/RetrieveFaceRequest.cc
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
* 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/cloudauth-console/model/RetrieveFaceRequest.h>
|
||||
|
||||
using AlibabaCloud::Cloudauth_console::Model::RetrieveFaceRequest;
|
||||
|
||||
RetrieveFaceRequest::RetrieveFaceRequest() :
|
||||
RpcServiceRequest("cloudauth-console", "2019-04-03", "RetrieveFace")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
RetrieveFaceRequest::~RetrieveFaceRequest()
|
||||
{}
|
||||
|
||||
std::string RetrieveFaceRequest::getFace64String()const
|
||||
{
|
||||
return face64String_;
|
||||
}
|
||||
|
||||
void RetrieveFaceRequest::setFace64String(const std::string& face64String)
|
||||
{
|
||||
face64String_ = face64String;
|
||||
setBodyParameter("Face64String", face64String);
|
||||
}
|
||||
|
||||
std::string RetrieveFaceRequest::getFaceUrl()const
|
||||
{
|
||||
return faceUrl_;
|
||||
}
|
||||
|
||||
void RetrieveFaceRequest::setFaceUrl(const std::string& faceUrl)
|
||||
{
|
||||
faceUrl_ = faceUrl;
|
||||
setParameter("FaceUrl", faceUrl);
|
||||
}
|
||||
|
||||
std::string RetrieveFaceRequest::getProjectId()const
|
||||
{
|
||||
return projectId_;
|
||||
}
|
||||
|
||||
void RetrieveFaceRequest::setProjectId(const std::string& projectId)
|
||||
{
|
||||
projectId_ = projectId;
|
||||
setParameter("ProjectId", projectId);
|
||||
}
|
||||
|
||||
68
cloudauth-console/src/model/RetrieveFaceResult.cc
Normal file
68
cloudauth-console/src/model/RetrieveFaceResult.cc
Normal file
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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/cloudauth-console/model/RetrieveFaceResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Cloudauth_console;
|
||||
using namespace AlibabaCloud::Cloudauth_console::Model;
|
||||
|
||||
RetrieveFaceResult::RetrieveFaceResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
RetrieveFaceResult::RetrieveFaceResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
RetrieveFaceResult::~RetrieveFaceResult()
|
||||
{}
|
||||
|
||||
void RetrieveFaceResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
auto allDataNode = value["Data"]["DataItem"];
|
||||
for (auto valueDataDataItem : allDataNode)
|
||||
{
|
||||
DataItem dataObject;
|
||||
if(!valueDataDataItem["UserId"].isNull())
|
||||
dataObject.userId = std::stol(valueDataDataItem["UserId"].asString());
|
||||
if(!valueDataDataItem["UserName"].isNull())
|
||||
dataObject.userName = valueDataDataItem["UserName"].asString();
|
||||
if(!valueDataDataItem["Rate"].isNull())
|
||||
dataObject.rate = valueDataDataItem["Rate"].asString();
|
||||
data_.push_back(dataObject);
|
||||
}
|
||||
if(!value["Success"].isNull())
|
||||
success_ = value["Success"].asString() == "true";
|
||||
|
||||
}
|
||||
|
||||
std::vector<RetrieveFaceResult::DataItem> RetrieveFaceResult::getData()const
|
||||
{
|
||||
return data_;
|
||||
}
|
||||
|
||||
bool RetrieveFaceResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
150
cloudauth-console/src/model/UploadIdentifyRecordRequest.cc
Normal file
150
cloudauth-console/src/model/UploadIdentifyRecordRequest.cc
Normal file
@@ -0,0 +1,150 @@
|
||||
/*
|
||||
* 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/cloudauth-console/model/UploadIdentifyRecordRequest.h>
|
||||
|
||||
using AlibabaCloud::Cloudauth_console::Model::UploadIdentifyRecordRequest;
|
||||
|
||||
UploadIdentifyRecordRequest::UploadIdentifyRecordRequest() :
|
||||
RpcServiceRequest("cloudauth-console", "2019-04-03", "UploadIdentifyRecord")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
UploadIdentifyRecordRequest::~UploadIdentifyRecordRequest()
|
||||
{}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getExt()const
|
||||
{
|
||||
return ext_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setExt(const std::string& ext)
|
||||
{
|
||||
ext_ = ext;
|
||||
setParameter("Ext", ext);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getIdentifyingImageUrl()const
|
||||
{
|
||||
return identifyingImageUrl_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setIdentifyingImageUrl(const std::string& identifyingImageUrl)
|
||||
{
|
||||
identifyingImageUrl_ = identifyingImageUrl;
|
||||
setParameter("IdentifyingImageUrl", identifyingImageUrl);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getIdentifyingImageBase64()const
|
||||
{
|
||||
return identifyingImageBase64_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setIdentifyingImageBase64(const std::string& identifyingImageBase64)
|
||||
{
|
||||
identifyingImageBase64_ = identifyingImageBase64;
|
||||
setBodyParameter("IdentifyingImageBase64", identifyingImageBase64);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getDeviceSecret()const
|
||||
{
|
||||
return deviceSecret_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setDeviceSecret(const std::string& deviceSecret)
|
||||
{
|
||||
deviceSecret_ = deviceSecret;
|
||||
setParameter("DeviceSecret", deviceSecret);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getProductKey()const
|
||||
{
|
||||
return productKey_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setProductKey(const std::string& productKey)
|
||||
{
|
||||
productKey_ = productKey;
|
||||
setParameter("ProductKey", productKey);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getUserId()const
|
||||
{
|
||||
return userId_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setUserId(const std::string& userId)
|
||||
{
|
||||
userId_ = userId;
|
||||
setParameter("UserId", userId);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getIotId()const
|
||||
{
|
||||
return iotId_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setIotId(const std::string& iotId)
|
||||
{
|
||||
iotId_ = iotId;
|
||||
setParameter("IotId", iotId);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getDeviceName()const
|
||||
{
|
||||
return deviceName_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setDeviceName(const std::string& deviceName)
|
||||
{
|
||||
deviceName_ = deviceName;
|
||||
setParameter("DeviceName", deviceName);
|
||||
}
|
||||
|
||||
long UploadIdentifyRecordRequest::getIdentifyingTime()const
|
||||
{
|
||||
return identifyingTime_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setIdentifyingTime(long identifyingTime)
|
||||
{
|
||||
identifyingTime_ = identifyingTime;
|
||||
setParameter("IdentifyingTime", std::to_string(identifyingTime));
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getProjectId()const
|
||||
{
|
||||
return projectId_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setProjectId(const std::string& projectId)
|
||||
{
|
||||
projectId_ = projectId;
|
||||
setParameter("ProjectId", projectId);
|
||||
}
|
||||
|
||||
std::string UploadIdentifyRecordRequest::getUserName()const
|
||||
{
|
||||
return userName_;
|
||||
}
|
||||
|
||||
void UploadIdentifyRecordRequest::setUserName(const std::string& userName)
|
||||
{
|
||||
userName_ = userName;
|
||||
setParameter("UserName", userName);
|
||||
}
|
||||
|
||||
58
cloudauth-console/src/model/UploadIdentifyRecordResult.cc
Normal file
58
cloudauth-console/src/model/UploadIdentifyRecordResult.cc
Normal file
@@ -0,0 +1,58 @@
|
||||
/*
|
||||
* 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/cloudauth-console/model/UploadIdentifyRecordResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Cloudauth_console;
|
||||
using namespace AlibabaCloud::Cloudauth_console::Model;
|
||||
|
||||
UploadIdentifyRecordResult::UploadIdentifyRecordResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
UploadIdentifyRecordResult::UploadIdentifyRecordResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
UploadIdentifyRecordResult::~UploadIdentifyRecordResult()
|
||||
{}
|
||||
|
||||
void UploadIdentifyRecordResult::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["HttpStatusCode"].isNull())
|
||||
httpStatusCode_ = std::stoi(value["HttpStatusCode"].asString());
|
||||
|
||||
}
|
||||
|
||||
int UploadIdentifyRecordResult::getHttpStatusCode()const
|
||||
{
|
||||
return httpStatusCode_;
|
||||
}
|
||||
|
||||
bool UploadIdentifyRecordResult::getSuccess()const
|
||||
{
|
||||
return success_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user