Kgapi

photo.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 <QString>
16
17#include <optional>
18
19class QJsonObject;
20class QJsonValue;
21class QJsonArray;
22
23namespace KGAPI2::People
24{
25class FieldMetadata;
26
27/**
28 * A person's photo. A picture shown next to the person's name to help others
29 * recognize the person.
30 *
31 * @see https://developers.google.com/people/api/rest/v1/people#photo
32 * @since 5.23.0
33 **/
34class KGAPIPEOPLE_EXPORT Photo
35{
36public:
37 /** Constructs a new Photo **/
38 explicit Photo();
39 Photo(const Photo &);
40 Photo(Photo &&) noexcept;
41 Photo &operator=(const Photo &);
42 Photo &operator=(Photo &&) noexcept;
43 /** Destructor. **/
45
46 bool operator==(const Photo &) const;
47 bool operator!=(const Photo &) const;
48
49 [[nodiscard]] static Photo fromJSON(const QJsonObject &);
50 [[nodiscard]] static QList<Photo> fromJSONArray(const QJsonArray &data);
51 [[nodiscard]] QJsonValue toJSON() const;
52
53 /** Metadata about the photo. **/
54 [[nodiscard]] FieldMetadata metadata() const;
55 /** Sets value of the metadata property. **/
56 void setMetadata(const FieldMetadata &value);
57
58 /** True if the photo is a default photo; false if the photo is a user-provided photo. **/
59 [[nodiscard]] bool isDefault() const;
60 /** Sets value of the isDefault property. **/
61 void setIsDefault(bool value);
62
63 /** The URL of the photo. You can change the desired size by appending a query parameter `sz={size}` at the end of the url, where {size} is the size in
64 * pixels. Example: https://lh3.googleusercontent.com/-T_wVWLlmg7w/AAAAAAAAAAI/AAAAAAAABa8/00gzXvDBYqw/s100/photo.jpg?sz=50 **/
65 [[nodiscard]] QString url() const;
66 /** Sets value of the url property. **/
67 void setUrl(const QString &value);
68
69private:
70 class Private;
72}; // Photo
73
74} // namespace KGAPI2::People
Metadata about a field.
A person's photo.
Definition photo.h:35
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Sat Dec 21 2024 17:00:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.