12#include "fieldmetadata.h"
13#include "peopleservice.h"
22namespace KGAPI2::People
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 && date == other.date && type == other.type && formattedType == other.formattedType;
39 bool operator!=(
const Private &other)
const
41 return !(*
this == other);
44 FieldMetadata metadata{};
61bool Event::operator==(const
Event &other)
const
63 return *d == *other.d;
66bool Event::operator!=(
const Event &other)
const
68 return !(*
this == other);
100 return d->formattedType;
109 event.d->metadata = FieldMetadata::fromJSON(
metadata);
111 const auto jsonDate = obj.
value(QStringLiteral(
"date")).
toObject();
112 const auto year = jsonDate.
value(QStringLiteral(
"year")).
toInt();
113 const auto month = jsonDate.value(QStringLiteral(
"month")).toInt();
114 const auto day = jsonDate.value(QStringLiteral(
"day")).toInt();
115 event.d->date =
QDate(year, month, day);
117 event.d->type = obj.
value(QStringLiteral(
"type")).
toString();
118 event.d->formattedType = obj.
value(QStringLiteral(
"formattedType")).
toString();
128 for(
const auto &event : data) {
129 if(event.isObject()) {
130 const auto objectifiedEvent =
event.toObject();
131 events.
append(fromJSON(objectifiedEvent));
144 { QStringLiteral(
"year"), d->date.year() },
145 { QStringLiteral(
"month"), d->date.month() },
146 { QStringLiteral(
"day"), d->date.day() }
150 PeopleUtils::addValueToJsonObjectIfValid(obj,
"type", d->type);
Represents a single event from Google Calendar.
An event related to the person.
QDate date() const
The date of the event.
void setType(const QString &value)
Sets value of the type property.
QString formattedType() const
Output only.
QString type() const
The type of the event.
void setDate(const QDate &value)
Sets value of the date property.
Event()
Constructs a new Event.
void setMetadata(const FieldMetadata &value)
Sets value of the metadata property.
FieldMetadata metadata() const
Metadata about the event.
bool isEmpty() const const
QJsonValue value(QLatin1StringView key) const const
int toInt(int defaultValue) const const
QJsonObject toObject() const const
QString toString() const const
void append(QList< T > &&value)