File indexing completed on 2025-03-09 04:52:25

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 
0009 #pragma once
0010 
0011 #include "kgapicore_export.h"
0012 #include "object.h"
0013 
0014 namespace KGAPI2
0015 {
0016 
0017 /**
0018  * @brief AccountInfo contains information about user's Google account.
0019  *
0020  * It is possible to obtain only information about account to which
0021  * we have access token.
0022  *
0023  * Some information might be empty, but id and email are guaranteed to
0024  * be always filled.
0025  *
0026  * The accountInfo service provides read-only access.
0027  *
0028  * @author Daniel Vrátil <dvratil@redhat.com>
0029  * @since 0.2
0030  */
0031 class KGAPICORE_EXPORT AccountInfo : public KGAPI2::Object
0032 {
0033 public:
0034     /**
0035      * @brief Constructor
0036      */
0037     AccountInfo();
0038 
0039     /**
0040      * @brief Copy constructor
0041      */
0042     AccountInfo(const AccountInfo &other);
0043 
0044     /**
0045      * @brief destructor
0046      */
0047     ~AccountInfo() override;
0048 
0049     bool operator==(const AccountInfo &other) const;
0050     bool operator!=(const AccountInfo &other) const
0051     {
0052         return !operator==(other);
0053     }
0054 
0055     /**
0056      * @brief Sets an account ID.
0057      *
0058      * @param id
0059      */
0060     void setId(const QString &id);
0061 
0062     /**
0063      * @brief Returns account ID.
0064      */
0065     [[nodiscard]] QString id() const;
0066 
0067     /**
0068      * @brief Sets account email.
0069      *
0070      * @param email
0071      */
0072     void setEmail(const QString &email);
0073 
0074     /**
0075      * @brief Returns account email address.
0076      *
0077      * Note that address does not have to be \@gmail.com.
0078      */
0079     [[nodiscard]] QString email() const;
0080 
0081     /**
0082      * @brief Sets user's real full name.
0083      *
0084      * @param name
0085      */
0086     void setName(const QString &name);
0087 
0088     /**
0089      * @brief Returns user's real full name.
0090      */
0091     [[nodiscard]] QString name() const;
0092 
0093     /**
0094      * @brief Sets user's given name.
0095      *
0096      * @param givenName
0097      */
0098     void setGivenName(const QString &givenName);
0099 
0100     /**
0101      * @brief Returns user's given name.
0102      */
0103     [[nodiscard]] QString givenName() const;
0104 
0105     /**
0106      * @brief Sets user's family name (surname).
0107      *
0108      * @param familyName
0109      */
0110     void setFamilyName(const QString &familyName);
0111 
0112     /**
0113      * @brief Returns user's surname.
0114      */
0115     [[nodiscard]] QString familyName() const;
0116 
0117     /**
0118      * @brief Sets user's birthday
0119      *
0120      * @param birthday
0121      */
0122     void setBirthday(const QString &birthday);
0123 
0124     /**
0125      * @brief Returns user's birthday.
0126      */
0127     [[nodiscard]] QString birthday() const;
0128 
0129     /**
0130      * @brief Sets user's gender.
0131      *
0132      * @param gender
0133      */
0134     void setGender(const QString &gender);
0135 
0136     /**
0137      * @brief Returns user's gender.
0138      */
0139     [[nodiscard]] QString gender() const;
0140 
0141     /**
0142      * @brief Sets link to user's profile.
0143      *
0144      * @param link
0145      */
0146     void setLink(const QString &link);
0147 
0148     /**
0149      * @brief Returns link to user's profile.
0150      */
0151     [[nodiscard]] QString link() const;
0152 
0153     /**
0154      * @brief Sets users locale settings.
0155      *
0156      * @param locale
0157      */
0158     void setLocale(const QString &locale);
0159 
0160     /**
0161      * @brief Returns user's preferred locales.
0162      */
0163     [[nodiscard]] QString locale() const;
0164 
0165     /**
0166      * @brief Sets user's timezone name.
0167      *
0168      * @param timezone
0169      */
0170     void setTimezone(const QString &timezone);
0171 
0172     /**
0173      * @brief Returns name of user's timezone.
0174      */
0175     [[nodiscard]] QString timezone() const;
0176 
0177     /**
0178      * @brief Sets whether the email address is verified.
0179      *
0180      * @param verified
0181      */
0182     void setVerifiedEmail(bool verified);
0183 
0184     /**
0185      * @brief Returns whether the email is verified.
0186      */
0187     [[nodiscard]] bool verifiedEmail() const;
0188 
0189     /**
0190      * @brief Sets URL of user's photo.
0191      *
0192      * @param url
0193      */
0194     void setPhotoUrl(const QString &url);
0195 
0196     /**
0197      * @brief Returns URL of user's photo.
0198      */
0199     [[nodiscard]] QString photoUrl() const;
0200 
0201     /**
0202      * @brief Parses raw JSON data into AccountInfo object.
0203      *
0204      * @param jsonData JSON data to parse
0205      */
0206     static AccountInfoPtr fromJSON(const QByteArray &jsonData);
0207 
0208 private:
0209     class Private;
0210     Private *const d;
0211     friend class Private;
0212 };
0213 
0214 } // namespace KGAPI2