Kgapi

birthday.h
1/*
2 * SPDX-FileCopyrightText: 2021 Daniel Vrátil <dvratil@kde.org>
3 * SPDX-FileCopyrightText: 2022 Claudio Cambra <claudio.cambra@kde.org>
4 *
5 * SPDX-License-Identifier: LGPL-2.1-only
6 * SPDX-License-Identifier: LGPL-3.0-only
7 * SPDX-License-Identifier: LicenseRef-KDE-Accepted-LGPL
8 */
9
10#pragma once
11
12#include <QSharedDataPointer>
13#include "kgapipeople_export.h"
14
15#include <QDate>
16#include <QString>
17
18#include <optional>
19
20class QJsonObject;
21class QJsonValue;
22class QJsonArray;
23
24namespace KGAPI2::People
25{
26class FieldMetadata;
27
28/**
29 * A person's birthday. At least one of the `date` and `text` fields are specified.
30 * The `date` and `text` fields typically represent the same date, but are not
31 * guaranteed to.
32 *
33 * @see https://developers.google.com/people/api/rest/v1/people#birthday
34 * @since 5.23.0
35 **/
36class KGAPIPEOPLE_EXPORT Birthday
37{
38public:
39 /** Constructs a new Birthday **/
40 explicit Birthday();
41 Birthday(const Birthday &);
42 Birthday(Birthday &&) noexcept;
43 Birthday &operator=(const Birthday &);
44 Birthday &operator=(Birthday &&) noexcept;
45 /** Destructor. **/
47
48 bool operator==(const Birthday &) const;
49 bool operator!=(const Birthday &) const;
50
51 [[nodiscard]] static Birthday fromJSON(const QJsonObject &obj);
52 [[nodiscard]] static QList<Birthday> fromJSONArray(const QJsonArray &data);
53 [[nodiscard]] QJsonValue toJSON() const;
54
55 /** A free-form string representing the user's birthday. **/
56 [[nodiscard]] QString text() const;
57 /** Sets value of the text property. **/
58 void setText(const QString &value);
59
60 /** Metadata about the birthday. **/
61 [[nodiscard]] FieldMetadata metadata() const;
62 /** Sets value of the metadata property. **/
63 void setMetadata(const FieldMetadata &value);
64
65 /** The date of the birthday. **/
66 [[nodiscard]] QDate date() const;
67 /** Sets value of the date property. **/
68 void setDate(const QDate &value);
69
70private:
71 class Private;
73}; // Birthday
74
75} // namespace KGAPI2::People
A person's birthday.
Definition birthday.h:37
Metadata about a field.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 27 2024 11:55:30 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.