Compare commits

..

1 Commits

Author SHA1 Message Date
sdk-team
b5e667c1d7 Update goodstech. 2020-11-16 02:36:26 +00:00
17 changed files with 1015 additions and 0 deletions

View File

@@ -1,3 +1,6 @@
2020-11-16 Version: patch
- Update goodstech.
2020-11-13 Version: patch
- Update Imageaudit.

94
goodstech/CMakeLists.txt Normal file
View File

@@ -0,0 +1,94 @@
#
# 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(goodstech_public_header
include/alibabacloud/goodstech/GoodstechClient.h
include/alibabacloud/goodstech/GoodstechExport.h )
set(goodstech_public_header_model
include/alibabacloud/goodstech/model/ClassifyCommodityRequest.h
include/alibabacloud/goodstech/model/ClassifyCommodityResult.h
include/alibabacloud/goodstech/model/RecognizeFurnitureAttributeRequest.h
include/alibabacloud/goodstech/model/RecognizeFurnitureAttributeResult.h
include/alibabacloud/goodstech/model/RecognizeFurnitureSpuRequest.h
include/alibabacloud/goodstech/model/RecognizeFurnitureSpuResult.h )
set(goodstech_src
src/GoodstechClient.cc
src/model/ClassifyCommodityRequest.cc
src/model/ClassifyCommodityResult.cc
src/model/RecognizeFurnitureAttributeRequest.cc
src/model/RecognizeFurnitureAttributeResult.cc
src/model/RecognizeFurnitureSpuRequest.cc
src/model/RecognizeFurnitureSpuResult.cc )
add_library(goodstech ${LIB_TYPE}
${goodstech_public_header}
${goodstech_public_header_model}
${goodstech_src})
set_target_properties(goodstech
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}goodstech
)
if(${LIB_TYPE} STREQUAL "SHARED")
set_target_properties(goodstech
PROPERTIES
DEFINE_SYMBOL ALIBABACLOUD_GOODSTECH_LIBRARY)
endif()
target_include_directories(goodstech
PRIVATE include
${CMAKE_SOURCE_DIR}/core/include
)
target_link_libraries(goodstech
core)
if(CMAKE_HOST_WIN32)
ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
set(jsoncpp_install_dir ${INSTALL_DIR})
add_dependencies(goodstech
jsoncpp)
target_include_directories(goodstech
PRIVATE ${jsoncpp_install_dir}/include)
target_link_libraries(goodstech
${jsoncpp_install_dir}/lib/jsoncpp.lib)
set_target_properties(goodstech
PROPERTIES
COMPILE_OPTIONS "/bigobj")
else()
target_include_directories(goodstech
PRIVATE /usr/include/jsoncpp)
target_link_libraries(goodstech
jsoncpp)
endif()
install(FILES ${goodstech_public_header}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/goodstech)
install(FILES ${goodstech_public_header_model}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/goodstech/model)
install(TARGETS goodstech
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)

View File

@@ -0,0 +1,70 @@
/*
* 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_GOODSTECH_GOODSTECHCLIENT_H_
#define ALIBABACLOUD_GOODSTECH_GOODSTECHCLIENT_H_
#include <future>
#include <alibabacloud/core/AsyncCallerContext.h>
#include <alibabacloud/core/EndpointProvider.h>
#include <alibabacloud/core/RpcServiceClient.h>
#include "GoodstechExport.h"
#include "model/ClassifyCommodityRequest.h"
#include "model/ClassifyCommodityResult.h"
#include "model/RecognizeFurnitureAttributeRequest.h"
#include "model/RecognizeFurnitureAttributeResult.h"
#include "model/RecognizeFurnitureSpuRequest.h"
#include "model/RecognizeFurnitureSpuResult.h"
namespace AlibabaCloud
{
namespace Goodstech
{
class ALIBABACLOUD_GOODSTECH_EXPORT GoodstechClient : public RpcServiceClient
{
public:
typedef Outcome<Error, Model::ClassifyCommodityResult> ClassifyCommodityOutcome;
typedef std::future<ClassifyCommodityOutcome> ClassifyCommodityOutcomeCallable;
typedef std::function<void(const GoodstechClient*, const Model::ClassifyCommodityRequest&, const ClassifyCommodityOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> ClassifyCommodityAsyncHandler;
typedef Outcome<Error, Model::RecognizeFurnitureAttributeResult> RecognizeFurnitureAttributeOutcome;
typedef std::future<RecognizeFurnitureAttributeOutcome> RecognizeFurnitureAttributeOutcomeCallable;
typedef std::function<void(const GoodstechClient*, const Model::RecognizeFurnitureAttributeRequest&, const RecognizeFurnitureAttributeOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeFurnitureAttributeAsyncHandler;
typedef Outcome<Error, Model::RecognizeFurnitureSpuResult> RecognizeFurnitureSpuOutcome;
typedef std::future<RecognizeFurnitureSpuOutcome> RecognizeFurnitureSpuOutcomeCallable;
typedef std::function<void(const GoodstechClient*, const Model::RecognizeFurnitureSpuRequest&, const RecognizeFurnitureSpuOutcome&, const std::shared_ptr<const AsyncCallerContext>&)> RecognizeFurnitureSpuAsyncHandler;
GoodstechClient(const Credentials &credentials, const ClientConfiguration &configuration);
GoodstechClient(const std::shared_ptr<CredentialsProvider> &credentialsProvider, const ClientConfiguration &configuration);
GoodstechClient(const std::string &accessKeyId, const std::string &accessKeySecret, const ClientConfiguration &configuration);
~GoodstechClient();
ClassifyCommodityOutcome classifyCommodity(const Model::ClassifyCommodityRequest &request)const;
void classifyCommodityAsync(const Model::ClassifyCommodityRequest& request, const ClassifyCommodityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
ClassifyCommodityOutcomeCallable classifyCommodityCallable(const Model::ClassifyCommodityRequest& request) const;
RecognizeFurnitureAttributeOutcome recognizeFurnitureAttribute(const Model::RecognizeFurnitureAttributeRequest &request)const;
void recognizeFurnitureAttributeAsync(const Model::RecognizeFurnitureAttributeRequest& request, const RecognizeFurnitureAttributeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeFurnitureAttributeOutcomeCallable recognizeFurnitureAttributeCallable(const Model::RecognizeFurnitureAttributeRequest& request) const;
RecognizeFurnitureSpuOutcome recognizeFurnitureSpu(const Model::RecognizeFurnitureSpuRequest &request)const;
void recognizeFurnitureSpuAsync(const Model::RecognizeFurnitureSpuRequest& request, const RecognizeFurnitureSpuAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context = nullptr) const;
RecognizeFurnitureSpuOutcomeCallable recognizeFurnitureSpuCallable(const Model::RecognizeFurnitureSpuRequest& request) const;
private:
std::shared_ptr<EndpointProvider> endpointProvider_;
};
}
}
#endif // !ALIBABACLOUD_GOODSTECH_GOODSTECHCLIENT_H_

View File

@@ -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_GOODSTECH_GOODSTECHEXPORT_H_
#define ALIBABACLOUD_GOODSTECH_GOODSTECHEXPORT_H_
#include <alibabacloud/core/Global.h>
#if defined(ALIBABACLOUD_SHARED)
# if defined(ALIBABACLOUD_GOODSTECH_LIBRARY)
# define ALIBABACLOUD_GOODSTECH_EXPORT ALIBABACLOUD_DECL_EXPORT
# else
# define ALIBABACLOUD_GOODSTECH_EXPORT ALIBABACLOUD_DECL_IMPORT
# endif
#else
# define ALIBABACLOUD_GOODSTECH_EXPORT
#endif
#endif // !ALIBABACLOUD_GOODSTECH_GOODSTECHEXPORT_H_

View File

@@ -0,0 +1,48 @@
/*
* 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_GOODSTECH_MODEL_CLASSIFYCOMMODITYREQUEST_H_
#define ALIBABACLOUD_GOODSTECH_MODEL_CLASSIFYCOMMODITYREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/goodstech/GoodstechExport.h>
namespace AlibabaCloud
{
namespace Goodstech
{
namespace Model
{
class ALIBABACLOUD_GOODSTECH_EXPORT ClassifyCommodityRequest : public RpcServiceRequest
{
public:
ClassifyCommodityRequest();
~ClassifyCommodityRequest();
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
private:
std::string imageURL_;
};
}
}
}
#endif // !ALIBABACLOUD_GOODSTECH_MODEL_CLASSIFYCOMMODITYREQUEST_H_

View File

@@ -0,0 +1,61 @@
/*
* 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_GOODSTECH_MODEL_CLASSIFYCOMMODITYRESULT_H_
#define ALIBABACLOUD_GOODSTECH_MODEL_CLASSIFYCOMMODITYRESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/goodstech/GoodstechExport.h>
namespace AlibabaCloud
{
namespace Goodstech
{
namespace Model
{
class ALIBABACLOUD_GOODSTECH_EXPORT ClassifyCommodityResult : public ServiceResult
{
public:
struct Data
{
struct Category
{
std::string categoryId;
float score;
std::string categoryName;
};
std::vector<Category> categories;
};
ClassifyCommodityResult();
explicit ClassifyCommodityResult(const std::string &payload);
~ClassifyCommodityResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_GOODSTECH_MODEL_CLASSIFYCOMMODITYRESULT_H_

View File

@@ -0,0 +1,48 @@
/*
* 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_GOODSTECH_MODEL_RECOGNIZEFURNITUREATTRIBUTEREQUEST_H_
#define ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITUREATTRIBUTEREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/goodstech/GoodstechExport.h>
namespace AlibabaCloud
{
namespace Goodstech
{
namespace Model
{
class ALIBABACLOUD_GOODSTECH_EXPORT RecognizeFurnitureAttributeRequest : public RpcServiceRequest
{
public:
RecognizeFurnitureAttributeRequest();
~RecognizeFurnitureAttributeRequest();
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
private:
std::string imageURL_;
};
}
}
}
#endif // !ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITUREATTRIBUTEREQUEST_H_

View File

@@ -0,0 +1,57 @@
/*
* 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_GOODSTECH_MODEL_RECOGNIZEFURNITUREATTRIBUTERESULT_H_
#define ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITUREATTRIBUTERESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/goodstech/GoodstechExport.h>
namespace AlibabaCloud
{
namespace Goodstech
{
namespace Model
{
class ALIBABACLOUD_GOODSTECH_EXPORT RecognizeFurnitureAttributeResult : public ServiceResult
{
public:
struct Data
{
std::string predStyle;
float predProbability;
std::string predStyleId;
};
RecognizeFurnitureAttributeResult();
explicit RecognizeFurnitureAttributeResult(const std::string &payload);
~RecognizeFurnitureAttributeResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITUREATTRIBUTERESULT_H_

View File

@@ -0,0 +1,57 @@
/*
* 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_GOODSTECH_MODEL_RECOGNIZEFURNITURESPUREQUEST_H_
#define ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITURESPUREQUEST_H_
#include <string>
#include <vector>
#include <alibabacloud/core/RpcServiceRequest.h>
#include <alibabacloud/goodstech/GoodstechExport.h>
namespace AlibabaCloud
{
namespace Goodstech
{
namespace Model
{
class ALIBABACLOUD_GOODSTECH_EXPORT RecognizeFurnitureSpuRequest : public RpcServiceRequest
{
public:
RecognizeFurnitureSpuRequest();
~RecognizeFurnitureSpuRequest();
float getXLength()const;
void setXLength(float xLength);
float getZLength()const;
void setZLength(float zLength);
std::string getImageURL()const;
void setImageURL(const std::string& imageURL);
float getYLength()const;
void setYLength(float yLength);
private:
float xLength_;
float zLength_;
std::string imageURL_;
float yLength_;
};
}
}
}
#endif // !ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITURESPUREQUEST_H_

View File

@@ -0,0 +1,57 @@
/*
* 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_GOODSTECH_MODEL_RECOGNIZEFURNITURESPURESULT_H_
#define ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITURESPURESULT_H_
#include <string>
#include <vector>
#include <utility>
#include <alibabacloud/core/ServiceResult.h>
#include <alibabacloud/goodstech/GoodstechExport.h>
namespace AlibabaCloud
{
namespace Goodstech
{
namespace Model
{
class ALIBABACLOUD_GOODSTECH_EXPORT RecognizeFurnitureSpuResult : public ServiceResult
{
public:
struct Data
{
float predProbability;
std::string predCate;
std::string predCateId;
};
RecognizeFurnitureSpuResult();
explicit RecognizeFurnitureSpuResult(const std::string &payload);
~RecognizeFurnitureSpuResult();
Data getData()const;
protected:
void parse(const std::string &payload);
private:
Data data_;
};
}
}
}
#endif // !ALIBABACLOUD_GOODSTECH_MODEL_RECOGNIZEFURNITURESPURESULT_H_

View File

@@ -0,0 +1,161 @@
/*
* 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/goodstech/GoodstechClient.h>
#include <alibabacloud/core/SimpleCredentialsProvider.h>
using namespace AlibabaCloud;
using namespace AlibabaCloud::Location;
using namespace AlibabaCloud::Goodstech;
using namespace AlibabaCloud::Goodstech::Model;
namespace
{
const std::string SERVICE_NAME = "goodstech";
}
GoodstechClient::GoodstechClient(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, "goodstech");
}
GoodstechClient::GoodstechClient(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, "goodstech");
}
GoodstechClient::GoodstechClient(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, "goodstech");
}
GoodstechClient::~GoodstechClient()
{}
GoodstechClient::ClassifyCommodityOutcome GoodstechClient::classifyCommodity(const ClassifyCommodityRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return ClassifyCommodityOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return ClassifyCommodityOutcome(ClassifyCommodityResult(outcome.result()));
else
return ClassifyCommodityOutcome(outcome.error());
}
void GoodstechClient::classifyCommodityAsync(const ClassifyCommodityRequest& request, const ClassifyCommodityAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, classifyCommodity(request), context);
};
asyncExecute(new Runnable(fn));
}
GoodstechClient::ClassifyCommodityOutcomeCallable GoodstechClient::classifyCommodityCallable(const ClassifyCommodityRequest &request) const
{
auto task = std::make_shared<std::packaged_task<ClassifyCommodityOutcome()>>(
[this, request]()
{
return this->classifyCommodity(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
GoodstechClient::RecognizeFurnitureAttributeOutcome GoodstechClient::recognizeFurnitureAttribute(const RecognizeFurnitureAttributeRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RecognizeFurnitureAttributeOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RecognizeFurnitureAttributeOutcome(RecognizeFurnitureAttributeResult(outcome.result()));
else
return RecognizeFurnitureAttributeOutcome(outcome.error());
}
void GoodstechClient::recognizeFurnitureAttributeAsync(const RecognizeFurnitureAttributeRequest& request, const RecognizeFurnitureAttributeAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, recognizeFurnitureAttribute(request), context);
};
asyncExecute(new Runnable(fn));
}
GoodstechClient::RecognizeFurnitureAttributeOutcomeCallable GoodstechClient::recognizeFurnitureAttributeCallable(const RecognizeFurnitureAttributeRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RecognizeFurnitureAttributeOutcome()>>(
[this, request]()
{
return this->recognizeFurnitureAttribute(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}
GoodstechClient::RecognizeFurnitureSpuOutcome GoodstechClient::recognizeFurnitureSpu(const RecognizeFurnitureSpuRequest &request) const
{
auto endpointOutcome = endpointProvider_->getEndpoint();
if (!endpointOutcome.isSuccess())
return RecognizeFurnitureSpuOutcome(endpointOutcome.error());
auto outcome = makeRequest(endpointOutcome.result(), request);
if (outcome.isSuccess())
return RecognizeFurnitureSpuOutcome(RecognizeFurnitureSpuResult(outcome.result()));
else
return RecognizeFurnitureSpuOutcome(outcome.error());
}
void GoodstechClient::recognizeFurnitureSpuAsync(const RecognizeFurnitureSpuRequest& request, const RecognizeFurnitureSpuAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
{
auto fn = [this, request, handler, context]()
{
handler(this, request, recognizeFurnitureSpu(request), context);
};
asyncExecute(new Runnable(fn));
}
GoodstechClient::RecognizeFurnitureSpuOutcomeCallable GoodstechClient::recognizeFurnitureSpuCallable(const RecognizeFurnitureSpuRequest &request) const
{
auto task = std::make_shared<std::packaged_task<RecognizeFurnitureSpuOutcome()>>(
[this, request]()
{
return this->recognizeFurnitureSpu(request);
});
asyncExecute(new Runnable([task]() { (*task)(); }));
return task->get_future();
}

View File

@@ -0,0 +1,40 @@
/*
* 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/goodstech/model/ClassifyCommodityRequest.h>
using AlibabaCloud::Goodstech::Model::ClassifyCommodityRequest;
ClassifyCommodityRequest::ClassifyCommodityRequest() :
RpcServiceRequest("goodstech", "2019-12-30", "ClassifyCommodity")
{
setMethod(HttpRequest::Method::Post);
}
ClassifyCommodityRequest::~ClassifyCommodityRequest()
{}
std::string ClassifyCommodityRequest::getImageURL()const
{
return imageURL_;
}
void ClassifyCommodityRequest::setImageURL(const std::string& imageURL)
{
imageURL_ = imageURL;
setParameter("ImageURL", imageURL);
}

View 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/goodstech/model/ClassifyCommodityResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Goodstech;
using namespace AlibabaCloud::Goodstech::Model;
ClassifyCommodityResult::ClassifyCommodityResult() :
ServiceResult()
{}
ClassifyCommodityResult::ClassifyCommodityResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
ClassifyCommodityResult::~ClassifyCommodityResult()
{}
void ClassifyCommodityResult::parse(const std::string &payload)
{
Json::Reader reader;
Json::Value value;
reader.parse(payload, value);
setRequestId(value["RequestId"].asString());
auto dataNode = value["Data"];
auto allCategoriesNode = dataNode["Categories"]["Category"];
for (auto dataNodeCategoriesCategory : allCategoriesNode)
{
Data::Category categoryObject;
if(!dataNodeCategoriesCategory["Score"].isNull())
categoryObject.score = std::stof(dataNodeCategoriesCategory["Score"].asString());
if(!dataNodeCategoriesCategory["CategoryName"].isNull())
categoryObject.categoryName = dataNodeCategoriesCategory["CategoryName"].asString();
if(!dataNodeCategoriesCategory["CategoryId"].isNull())
categoryObject.categoryId = dataNodeCategoriesCategory["CategoryId"].asString();
data_.categories.push_back(categoryObject);
}
}
ClassifyCommodityResult::Data ClassifyCommodityResult::getData()const
{
return data_;
}

View File

@@ -0,0 +1,40 @@
/*
* 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/goodstech/model/RecognizeFurnitureAttributeRequest.h>
using AlibabaCloud::Goodstech::Model::RecognizeFurnitureAttributeRequest;
RecognizeFurnitureAttributeRequest::RecognizeFurnitureAttributeRequest() :
RpcServiceRequest("goodstech", "2019-12-30", "RecognizeFurnitureAttribute")
{
setMethod(HttpRequest::Method::Post);
}
RecognizeFurnitureAttributeRequest::~RecognizeFurnitureAttributeRequest()
{}
std::string RecognizeFurnitureAttributeRequest::getImageURL()const
{
return imageURL_;
}
void RecognizeFurnitureAttributeRequest::setImageURL(const std::string& imageURL)
{
imageURL_ = imageURL;
setBodyParameter("ImageURL", imageURL);
}

View File

@@ -0,0 +1,56 @@
/*
* 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/goodstech/model/RecognizeFurnitureAttributeResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Goodstech;
using namespace AlibabaCloud::Goodstech::Model;
RecognizeFurnitureAttributeResult::RecognizeFurnitureAttributeResult() :
ServiceResult()
{}
RecognizeFurnitureAttributeResult::RecognizeFurnitureAttributeResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RecognizeFurnitureAttributeResult::~RecognizeFurnitureAttributeResult()
{}
void RecognizeFurnitureAttributeResult::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["PredStyleId"].isNull())
data_.predStyleId = dataNode["PredStyleId"].asString();
if(!dataNode["PredStyle"].isNull())
data_.predStyle = dataNode["PredStyle"].asString();
if(!dataNode["PredProbability"].isNull())
data_.predProbability = std::stof(dataNode["PredProbability"].asString());
}
RecognizeFurnitureAttributeResult::Data RecognizeFurnitureAttributeResult::getData()const
{
return data_;
}

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/goodstech/model/RecognizeFurnitureSpuRequest.h>
using AlibabaCloud::Goodstech::Model::RecognizeFurnitureSpuRequest;
RecognizeFurnitureSpuRequest::RecognizeFurnitureSpuRequest() :
RpcServiceRequest("goodstech", "2019-12-30", "RecognizeFurnitureSpu")
{
setMethod(HttpRequest::Method::Post);
}
RecognizeFurnitureSpuRequest::~RecognizeFurnitureSpuRequest()
{}
float RecognizeFurnitureSpuRequest::getXLength()const
{
return xLength_;
}
void RecognizeFurnitureSpuRequest::setXLength(float xLength)
{
xLength_ = xLength;
setBodyParameter("XLength", std::to_string(xLength));
}
float RecognizeFurnitureSpuRequest::getZLength()const
{
return zLength_;
}
void RecognizeFurnitureSpuRequest::setZLength(float zLength)
{
zLength_ = zLength;
setBodyParameter("ZLength", std::to_string(zLength));
}
std::string RecognizeFurnitureSpuRequest::getImageURL()const
{
return imageURL_;
}
void RecognizeFurnitureSpuRequest::setImageURL(const std::string& imageURL)
{
imageURL_ = imageURL;
setBodyParameter("ImageURL", imageURL);
}
float RecognizeFurnitureSpuRequest::getYLength()const
{
return yLength_;
}
void RecognizeFurnitureSpuRequest::setYLength(float yLength)
{
yLength_ = yLength;
setBodyParameter("YLength", std::to_string(yLength));
}

View File

@@ -0,0 +1,56 @@
/*
* 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/goodstech/model/RecognizeFurnitureSpuResult.h>
#include <json/json.h>
using namespace AlibabaCloud::Goodstech;
using namespace AlibabaCloud::Goodstech::Model;
RecognizeFurnitureSpuResult::RecognizeFurnitureSpuResult() :
ServiceResult()
{}
RecognizeFurnitureSpuResult::RecognizeFurnitureSpuResult(const std::string &payload) :
ServiceResult()
{
parse(payload);
}
RecognizeFurnitureSpuResult::~RecognizeFurnitureSpuResult()
{}
void RecognizeFurnitureSpuResult::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["PredCateId"].isNull())
data_.predCateId = dataNode["PredCateId"].asString();
if(!dataNode["PredCate"].isNull())
data_.predCate = dataNode["PredCate"].asString();
if(!dataNode["PredProbability"].isNull())
data_.predProbability = std::stof(dataNode["PredProbability"].asString());
}
RecognizeFurnitureSpuResult::Data RecognizeFurnitureSpuResult::getData()const
{
return data_;
}