10#include "clientdata.h"
12#include "fieldmetadata.h"
13#include "peopleservice.h"
22namespace KGAPI2::People
24class ClientData::Private :
public QSharedData
27 explicit Private() =
default;
28 Private(
const Private &) =
default;
29 Private(Private &&) noexcept = delete;
30 Private &operator=(const Private &) = delete;
31 Private &operator=(Private &&) noexcept = delete;
34 bool operator==(const Private &other)
const
36 return metadata == other.metadata && key == other.key && value == other.value;
39 bool operator!=(
const Private &other)
const
41 return !(*
this == other);
44 FieldMetadata metadata{};
62 return *d == *other.d;
65bool ClientData::operator!=(
const ClientData &other)
const
67 return !(*
this == other);
105 clientData.
setKey(obj.
value(QStringLiteral(
"key")).toString());
106 clientData.
setValue(obj.
value(QStringLiteral(
"value")).toString());
116 for(
const auto &jsonClientData : data) {
117 if(jsonClientData.isObject()) {
118 const auto objectifiedClientData = jsonClientData.toObject();
119 clientData.
append(fromJSON(objectifiedClientData));
126QJsonValue ClientData::toJSON()
const
131 PeopleUtils::addValueToJsonObjectIfValid(obj,
"key", d->key);
132 PeopleUtils::addValueToJsonObjectIfValid(obj,
"value", d->value);
Arbitrary client data that is populated by clients.
ClientData()
Constructs a new ClientData.
QString value() const
The client specified value of the client data.
void setValue(const QString &value)
Sets value of the value property.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
FieldMetadata metadata() const
Metadata about the client data.
QString key() const
The client specified key of the client data.
void setKey(const QString &value)
Sets value of the key property.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
QJsonObject toObject() const const
void append(QList< T > &&value)