10#include "profilemetadata.h"
11#include "peopleservice.h"
20namespace KGAPI2::People
25 explicit Private() =
default;
26 Private(
const Private &) =
default;
27 Private(Private &&) noexcept = delete;
28 Private &operator=(const Private &) = delete;
29 Private &operator=(Private &&) noexcept = delete;
32 bool operator==(const Private &other)
const
34 return userTypes == other.userTypes && objectType == other.objectType;
37 bool operator!=(
const Private &other)
const
39 return !(*
this == other);
59 return *d == *other.d;
62bool ProfileMetadata::operator!=(
const ProfileMetadata &other)
const
64 return !(*
this == other);
81 const auto objectTypeEnumString = obj.
value(QStringLiteral(
"objectType"));
90 if(obj.
value(QStringLiteral(
"userTypes")).isArray()) {
91 const auto userTypesJsonArray = obj.
value(QStringLiteral(
"userTypes")).
toArray();
93 for (
const auto &userType : userTypesJsonArray) {
94 if(userType == obj.
value(QStringLiteral(
"GOOGLE_USER"))) {
96 }
else if(userType == obj.
value(QStringLiteral(
"GPLUS_USER"))) {
98 }
else if(userType == obj.
value(QStringLiteral(
"GOOGLE_APPS_USER"))) {
109 return profileMetadata;
118 std::transform(d->userTypes.cbegin(), d->userTypes.cend(), std::back_inserter(arr), [](
const auto &val) {
121 case UserTypes::USER_TYPE_UNKNOWN:
122 return QStringLiteral(
"USER_TYPE_UNKNOWN");
123 case UserTypes::GOOGLE_USER:
124 return QStringLiteral(
"GOOGLE_USER");
125 case UserTypes::GPLUS_USER:
126 return QStringLiteral(
"GPLUS_USER");
127 case UserTypes::GOOGLE_APPS_USER:
128 return QStringLiteral(
"GOOGLE_APPS_USER");
132 PeopleUtils::addValueToJsonObjectIfValid(obj,
"userTypes", std::move(arr));
135 switch (d->objectType) {
136 case ObjectType::OBJECT_TYPE_UNSPECIFIED:
137 PeopleUtils::addValueToJsonObjectIfValid(obj,
"objectType", QStringLiteral(
"OBJECT_TYPE_UNSPECIFIED"));
139 case ObjectType::PERSON:
140 PeopleUtils::addValueToJsonObjectIfValid(obj,
"objectType", QStringLiteral(
"PERSON"));
142 case ObjectType::PAGE:
143 PeopleUtils::addValueToJsonObjectIfValid(obj,
"objectType", QStringLiteral(
"PAGE"));
bool isEmpty() const const
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
QJsonArray toArray() const const