Supported AndroidNotificationHuaweiChannel for Push and MassPush.
This commit is contained in:
@@ -663,6 +663,42 @@ PushClient::QueryAliasesOutcomeCallable PushClient::queryAliasesCallable(const Q
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
PushClient::QueryDeviceCountOutcome PushClient::queryDeviceCount(const QueryDeviceCountRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
if (!endpointOutcome.isSuccess())
|
||||
return QueryDeviceCountOutcome(endpointOutcome.error());
|
||||
|
||||
auto outcome = makeRequest(endpointOutcome.result(), request);
|
||||
|
||||
if (outcome.isSuccess())
|
||||
return QueryDeviceCountOutcome(QueryDeviceCountResult(outcome.result()));
|
||||
else
|
||||
return QueryDeviceCountOutcome(outcome.error());
|
||||
}
|
||||
|
||||
void PushClient::queryDeviceCountAsync(const QueryDeviceCountRequest& request, const QueryDeviceCountAsyncHandler& handler, const std::shared_ptr<const AsyncCallerContext>& context) const
|
||||
{
|
||||
auto fn = [this, request, handler, context]()
|
||||
{
|
||||
handler(this, request, queryDeviceCount(request), context);
|
||||
};
|
||||
|
||||
asyncExecute(new Runnable(fn));
|
||||
}
|
||||
|
||||
PushClient::QueryDeviceCountOutcomeCallable PushClient::queryDeviceCountCallable(const QueryDeviceCountRequest &request) const
|
||||
{
|
||||
auto task = std::make_shared<std::packaged_task<QueryDeviceCountOutcome()>>(
|
||||
[this, request]()
|
||||
{
|
||||
return this->queryDeviceCount(request);
|
||||
});
|
||||
|
||||
asyncExecute(new Runnable([task]() { (*task)(); }));
|
||||
return task->get_future();
|
||||
}
|
||||
|
||||
PushClient::QueryDeviceInfoOutcome PushClient::queryDeviceInfo(const QueryDeviceInfoRequest &request) const
|
||||
{
|
||||
auto endpointOutcome = endpointProvider_->getEndpoint();
|
||||
|
||||
@@ -69,6 +69,7 @@ void MassPushRequest::setPushTask(const std::vector<PushTask>& pushTask)
|
||||
setParameter(pushTaskObjStr + ".IOSMutableContent", pushTaskObj.iOSMutableContent ? "true" : "false");
|
||||
setParameter(pushTaskObjStr + ".AndroidNotificationBarPriority", std::to_string(pushTaskObj.androidNotificationBarPriority));
|
||||
setParameter(pushTaskObjStr + ".ExpireTime", pushTaskObj.expireTime);
|
||||
setParameter(pushTaskObjStr + ".AndroidNotificationVivoChannel", pushTaskObj.androidNotificationVivoChannel);
|
||||
setParameter(pushTaskObjStr + ".AndroidPopupBody", pushTaskObj.androidPopupBody);
|
||||
setParameter(pushTaskObjStr + ".IOSNotificationCategory", pushTaskObj.iOSNotificationCategory);
|
||||
setParameter(pushTaskObjStr + ".AndroidNotificationXiaomiChannel", pushTaskObj.androidNotificationXiaomiChannel);
|
||||
|
||||
@@ -192,6 +192,17 @@ void PushRequest::setExpireTime(const std::string& expireTime)
|
||||
setParameter("ExpireTime", expireTime);
|
||||
}
|
||||
|
||||
std::string PushRequest::getAndroidNotificationVivoChannel()const
|
||||
{
|
||||
return androidNotificationVivoChannel_;
|
||||
}
|
||||
|
||||
void PushRequest::setAndroidNotificationVivoChannel(const std::string& androidNotificationVivoChannel)
|
||||
{
|
||||
androidNotificationVivoChannel_ = androidNotificationVivoChannel;
|
||||
setParameter("AndroidNotificationVivoChannel", androidNotificationVivoChannel);
|
||||
}
|
||||
|
||||
std::string PushRequest::getIOSNotificationCategory()const
|
||||
{
|
||||
return iOSNotificationCategory_;
|
||||
|
||||
73
push/src/model/QueryDeviceCountRequest.cc
Normal file
73
push/src/model/QueryDeviceCountRequest.cc
Normal 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/push/model/QueryDeviceCountRequest.h>
|
||||
|
||||
using AlibabaCloud::Push::Model::QueryDeviceCountRequest;
|
||||
|
||||
QueryDeviceCountRequest::QueryDeviceCountRequest() :
|
||||
RpcServiceRequest("push", "2016-08-01", "QueryDeviceCount")
|
||||
{
|
||||
setMethod(HttpRequest::Method::Post);
|
||||
}
|
||||
|
||||
QueryDeviceCountRequest::~QueryDeviceCountRequest()
|
||||
{}
|
||||
|
||||
std::string QueryDeviceCountRequest::getAccessKeyId()const
|
||||
{
|
||||
return accessKeyId_;
|
||||
}
|
||||
|
||||
void QueryDeviceCountRequest::setAccessKeyId(const std::string& accessKeyId)
|
||||
{
|
||||
accessKeyId_ = accessKeyId;
|
||||
setParameter("AccessKeyId", accessKeyId);
|
||||
}
|
||||
|
||||
std::string QueryDeviceCountRequest::getTarget()const
|
||||
{
|
||||
return target_;
|
||||
}
|
||||
|
||||
void QueryDeviceCountRequest::setTarget(const std::string& target)
|
||||
{
|
||||
target_ = target;
|
||||
setParameter("Target", target);
|
||||
}
|
||||
|
||||
long QueryDeviceCountRequest::getAppKey()const
|
||||
{
|
||||
return appKey_;
|
||||
}
|
||||
|
||||
void QueryDeviceCountRequest::setAppKey(long appKey)
|
||||
{
|
||||
appKey_ = appKey;
|
||||
setParameter("AppKey", std::to_string(appKey));
|
||||
}
|
||||
|
||||
std::string QueryDeviceCountRequest::getTargetValue()const
|
||||
{
|
||||
return targetValue_;
|
||||
}
|
||||
|
||||
void QueryDeviceCountRequest::setTargetValue(const std::string& targetValue)
|
||||
{
|
||||
targetValue_ = targetValue;
|
||||
setParameter("TargetValue", targetValue);
|
||||
}
|
||||
|
||||
51
push/src/model/QueryDeviceCountResult.cc
Normal file
51
push/src/model/QueryDeviceCountResult.cc
Normal file
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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/push/model/QueryDeviceCountResult.h>
|
||||
#include <json/json.h>
|
||||
|
||||
using namespace AlibabaCloud::Push;
|
||||
using namespace AlibabaCloud::Push::Model;
|
||||
|
||||
QueryDeviceCountResult::QueryDeviceCountResult() :
|
||||
ServiceResult()
|
||||
{}
|
||||
|
||||
QueryDeviceCountResult::QueryDeviceCountResult(const std::string &payload) :
|
||||
ServiceResult()
|
||||
{
|
||||
parse(payload);
|
||||
}
|
||||
|
||||
QueryDeviceCountResult::~QueryDeviceCountResult()
|
||||
{}
|
||||
|
||||
void QueryDeviceCountResult::parse(const std::string &payload)
|
||||
{
|
||||
Json::Reader reader;
|
||||
Json::Value value;
|
||||
reader.parse(payload, value);
|
||||
setRequestId(value["RequestId"].asString());
|
||||
if(!value["DeviceCount"].isNull())
|
||||
deviceCount_ = std::stol(value["DeviceCount"].asString());
|
||||
|
||||
}
|
||||
|
||||
long QueryDeviceCountResult::getDeviceCount()const
|
||||
{
|
||||
return deviceCount_;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user