File indexing completed on 2024-05-12 05:22:24
0001 /* 0002 * This file is part of LibKGAPI library 0003 * 0004 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0007 */ 0008 #pragma once 0009 0010 #include "kgapidrive_export.h" 0011 #include "types.h" 0012 0013 #include <QString> 0014 #include <QUrl> 0015 #include <QVariantMap> 0016 0017 namespace KGAPI2 0018 { 0019 0020 namespace Drive 0021 { 0022 0023 /** 0024 * @brief The authenticated user. 0025 */ 0026 class KGAPIDRIVE_EXPORT User 0027 { 0028 public: 0029 explicit User(const User &other); 0030 virtual ~User(); 0031 bool operator==(const User &other) const; 0032 bool operator!=(const User &other) const 0033 { 0034 return !operator==(other); 0035 } 0036 0037 /** 0038 * @brief Returns a plain text displayable name for this user. 0039 */ 0040 [[nodiscard]] QString displayName() const; 0041 0042 /** 0043 * @brief Returns a URL that points to a profile picture of this user. 0044 */ 0045 [[nodiscard]] QUrl pictureUrl() const; 0046 0047 /** 0048 * @brief Returns whether this user is the same as the authenticated 0049 * user for whom the request was made. 0050 */ 0051 [[nodiscard]] bool isAuthenticatedUser() const; 0052 0053 /** 0054 * @brief Returns the user's ID as visible in the permissions collection. 0055 */ 0056 [[nodiscard]] QString permissionId() const; 0057 0058 static UserPtr fromJSON(const QVariantMap &jsonMap); 0059 0060 private: 0061 explicit User(); 0062 0063 class Private; 0064 Private *const d; 0065 friend class Private; 0066 }; 0067 0068 } // namespace Drive 0069 0070 } // namespace KGAPI2