12#include "fieldmetadata.h"
13#include "peopleservice.h"
22namespace KGAPI2::People
25struct ImClientDefinition {
26 FieldMetadata metadata;
37 explicit Private() =
default;
38 Private(
const Private &) =
default;
39 Private(Private &&) noexcept = delete;
40 Private &operator=(const Private &) = delete;
41 Private &operator=(Private &&) noexcept = delete;
44 bool operator==(const Private &other)
const
46 return protocol == other.protocol && username == other.username && type == other.type && metadata == other.metadata
47 && formattedType == other.formattedType && formattedProtocol == other.formattedProtocol;
50 bool operator!=(
const Private &other)
const
52 return !(*
this == other);
58 FieldMetadata metadata{};
71 d->metadata = definition.metadata;
72 d->username = definition.username;
73 d->type = definition.type;
74 d->formattedType = definition.formattedType;
75 d->protocol = definition.protocol;
76 d->formattedProtocol = definition.formattedProtocol;
81ImClient &ImClient::operator=(const ImClient &) = default;
82ImClient &ImClient::operator=(ImClient &&) noexcept = default;
83ImClient::~ImClient() = default;
85bool ImClient::operator==(const ImClient &other)
const
87 return *d == *other.d;
90bool ImClient::operator!=(
const ImClient &other)
const
92 return !(*
this == other);
133 return d->formattedType;
137 return d->formattedProtocol;
146 ImClientDefinition definition;
149 definition.metadata = FieldMetadata::fromJSON(
metadata);
150 definition.username = obj.
value(QStringLiteral(
"username")).
toString();
151 definition.type = obj.
value(QStringLiteral(
"type")).
toString();
152 definition.formattedType = obj.
value(QStringLiteral(
"formattedType")).
toString();
153 definition.protocol = obj.
value(QStringLiteral(
"protocol")).
toString();
154 definition.formattedProtocol = obj.
value(QStringLiteral(
"formattedProtocol")).
toString();
163 for(
const auto &imClient : data) {
164 if(imClient.isObject()) {
165 const auto objectifiedImClient = imClient.toObject();
166 imClients.
append(fromJSON(objectifiedImClient));
177 PeopleUtils::addValueToJsonObjectIfValid(obj,
"protocol", d->protocol);
178 PeopleUtils::addValueToJsonObjectIfValid(obj,
"username", d->username);
179 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", d->type);
A person's instant messaging client.
void setUsername(const QString &value)
Sets value of the username property.
void setType(const QString &value)
Sets value of the type property.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
QString formattedType() const
Output only.
QString type() const
The type of the IM client.
QString protocol() const
The protocol of the IM client.
QString formattedProtocol() const
Output only.
QString username() const
The user name used in the IM client.
void setProtocol(const QString &value)
Sets value of the protocol property.
FieldMetadata metadata() const
Metadata about the IM client.
ImClient()
Constructs a new ImClient.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
QJsonObject toObject() const const
QString toString() const const
void append(QList< T > &&value)