10#include "misckeyword.h"
12#include "fieldmetadata.h"
13#include "peopleservice.h"
22namespace KGAPI2::People
25struct MiscKeywordDefinition
27 FieldMetadata metadata;
36 explicit Private() =
default;
37 Private(
const Private &) =
default;
38 Private(Private &&) noexcept = delete;
39 Private &operator=(const Private &) = delete;
40 Private &operator=(Private &&) noexcept = delete;
43 bool operator==(const Private &other)
const
45 return metadata == other.metadata && value == other.value && type == other.type && formattedType == other.formattedType;
48 bool operator!=(
const Private &other)
const
50 return !(*
this == other);
53 FieldMetadata metadata{};
67 d->metadata = definition.metadata;
68 d->value = definition.value;
69 d->type = definition.type;
70 d->formattedType = definition.formattedType;
75MiscKeyword &MiscKeyword::operator=(const MiscKeyword &) = default;
76MiscKeyword &MiscKeyword::operator=(MiscKeyword &&) noexcept = default;
77MiscKeyword::~MiscKeyword() = default;
79bool MiscKeyword::operator==(const MiscKeyword &other)
const
81 return *d == *other.d;
84bool MiscKeyword::operator!=(
const MiscKeyword &other)
const
86 return !(*
this == other);
118 return d->formattedType;
127 MiscKeywordDefinition definition;
130 definition.metadata = FieldMetadata::fromJSON(
metadata);
131 definition.value = obj.
value(QStringLiteral(
"value")).
toString();
160 definition.formattedType = obj.
value(QStringLiteral(
"formattedType")).
toString();
169 for(
const auto &miscKeyword : data) {
170 if(miscKeyword.isObject()) {
171 const auto objectifiedMiscKeyword = miscKeyword.toObject();
172 miscKeywords.
append(fromJSON(objectifiedMiscKeyword));
184 PeopleUtils::addValueToJsonObjectIfValid(obj,
"value", d->value);
187 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"TYPE_UNSPECIFIED"));
190 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_BILLING_INFORMATION"));
193 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_DIRECTORY_SERVER"));
196 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_KEYWORD"));
199 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_MILEAGE"));
202 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_PRIORITY"));
205 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_SENSITIVITY"));
208 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_SUBJECT"));
211 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OUTLOOK_USER"));
214 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"HOME"));
217 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"WORK"));
220 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", QStringLiteral(
"OTHER"));
A person's miscellaneous keyword.
QString formattedType() const
Output only.
FieldMetadata metadata() const
Metadata about the miscellaneous keyword.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
@ OUTLOOK_USER
Outlook field for user.
@ OUTLOOK_DIRECTORY_SERVER
Outlook field for directory server.
@ TYPE_UNSPECIFIED
Unspecified.
@ OUTLOOK_MILEAGE
Outlook field for mileage.
@ OUTLOOK_PRIORITY
Outlook field for priority.
@ OUTLOOK_KEYWORD
Outlook field for keyword.
@ OUTLOOK_SENSITIVITY
Outlook field for sensitivity.
@ OUTLOOK_SUBJECT
Outlook field for subject.
@ OUTLOOK_BILLING_INFORMATION
Outlook field for billing information.
void setValue(const QString &value)
Sets value of the value property.
MiscKeyword()
Constructs a new MiscKeyword.
MiscKeyword::Type type() const
The miscellaneous keyword type.
QString value() const
The value of the miscellaneous keyword.
void setType(MiscKeyword::Type value)
Sets value of the type property.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
QJsonObject toObject() const const
QString toString() const const
void append(QList< T > &&value)