const QueryParamsMap& options,
PostCallback cloudConnectHandler)
{
+ if (authProvider.empty() || authCode.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACCOUNT_URI;
OCRepresentation rep;
if (!options.empty())
{
- OCRepresentation optionsRep;
for (auto iter : options)
{
- optionsRep[iter.first] = iter.second;
+ rep.setValue(iter.first, iter.second);
}
- rep.setValue(OC_RSRVD_OPTIONS, optionsRep);
}
return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
const std::string& accessToken,
PostCallback cloudConnectHandler)
{
+ if (userUuid.empty() || accessToken.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
return result_guard(signInOut(userUuid, accessToken, true, cloudConnectHandler));
}
const std::string& refreshToken,
PostCallback cloudConnectHandler)
{
+ if (userUuid.empty() || refreshToken.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACCOUNT_TOKEN_REFRESH_URI;
OCRepresentation rep;
OCStackResult OCAccountManager::searchUser(const std::string& userUuid,
GetCallback cloudConnectHandler)
{
+ if (userUuid.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
return result_guard(searchUser(userUuid, QueryParamsMap(), cloudConnectHandler));
}
OCStackResult OCAccountManager::searchUser(const QueryParamsMap& queryParams,
GetCallback cloudConnectHandler)
{
+ if (queryParams.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
return result_guard(searchUser("", queryParams, cloudConnectHandler));
}
OCStackResult OCAccountManager::deleteDevice(const std::string& deviceId,
DeleteCallback cloudConnectHandler)
{
+ if (deviceId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACCOUNT_URI
+ "?" + OC_RSRVD_DEVICE_ID + "=" + deviceId;
OCStackResult OCAccountManager::deleteGroup(const std::string& groupId,
DeleteCallback cloudConnectHandler)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI
+ "?" + OC_RSRVD_GROUP_ID + "=" + groupId;
OCStackResult OCAccountManager::joinGroup(const std::string& groupId,
PostCallback cloudConnectHandler)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
return checked_guard(m_clientWrapper.lock(), &IClientWrapper::PostResourceRepresentation,
const std::vector<std::string>& deviceId,
PostCallback cloudConnectHandler)
{
- if (deviceId.empty())
+ if (groupId.empty() || deviceId.empty())
{
return result_guard(OC_STACK_INVALID_PARAM);
}
OCStackResult OCAccountManager::getGroupInfo(const std::string& groupId,
GetCallback cloudConnectHandler)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
return checked_guard(m_clientWrapper.lock(), &IClientWrapper::GetResourceRepresentation,
OCStackResult OCAccountManager::leaveGroup(const std::string& groupId,
DeleteCallback cloudConnectHandler)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,
const std::vector<std::string>& deviceId,
DeleteCallback cloudConnectHandler)
{
- if (deviceId.empty())
+ if (groupId.empty() || deviceId.empty())
{
return result_guard(OC_STACK_INVALID_PARAM);
}
OCStackResult OCAccountManager::observeGroup(const std::string& groupId,
ObserveCallback cloudConnectHandler)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_GROUP_URI + "/" + groupId;
OCDoHandle handle = nullptr;
OCStackResult OCAccountManager::cancelObserveGroup(const std::string& groupId)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
auto found = m_groupObserveHandles.find(groupId);
if (m_groupObserveHandles.end() == found)
{
const std::string& userUuid,
PostCallback cloudConnectHandler)
{
+ if (groupId.empty() || userUuid.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI;
OCRepresentation invitation;
const std::string& userUuid,
DeleteCallback cloudConnectHandler)
{
+ if (groupId.empty() || userUuid.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI + "?" + OC_RSRVD_GROUP_ID + "=" + groupId
+ ";" + OC_RSRVD_MEMBER_ID + "=" + userUuid;
OCStackResult OCAccountManager::deleteInvitation(const std::string& groupId,
DeleteCallback cloudConnectHandler)
{
+ if (groupId.empty())
+ {
+ return result_guard(OC_STACK_INVALID_PARAM);
+ }
+
std::string uri = m_host + OC_RSRVD_ACL_INVITE_URI + "?" + OC_RSRVD_GROUP_ID + "=" + groupId;
return checked_guard(m_clientWrapper.lock(), &IClientWrapper::DeleteResource,