Kgapi

accountinfo.h
1/*
2 * This file is part of LibKGAPI library
3 *
4 * SPDX-FileCopyrightText: 2013 Daniel Vrátil <dvratil@redhat.com>
5 *
6 * SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
7 */
8
9#pragma once
10
11#include "kgapicore_export.h"
12#include "object.h"
13
14namespace KGAPI2
15{
16
17/**
18 * @brief AccountInfo contains information about user's Google account.
19 *
20 * It is possible to obtain only information about account to which
21 * we have access token.
22 *
23 * Some information might be empty, but id and email are guaranteed to
24 * be always filled.
25 *
26 * The accountInfo service provides read-only access.
27 *
28 * @author Daniel Vrátil <dvratil@redhat.com>
29 * @since 0.2
30 */
31class KGAPICORE_EXPORT AccountInfo : public KGAPI2::Object
32{
33public:
34 /**
35 * @brief Constructor
36 */
38
39 /**
40 * @brief Copy constructor
41 */
42 AccountInfo(const AccountInfo &other);
43
44 /**
45 * @brief destructor
46 */
47 ~AccountInfo() override;
48
49 bool operator==(const AccountInfo &other) const;
50 bool operator!=(const AccountInfo &other) const
51 {
52 return !operator==(other);
53 }
54
55 /**
56 * @brief Sets an account ID.
57 *
58 * @param id
59 */
60 void setId(const QString &id);
61
62 /**
63 * @brief Returns account ID.
64 */
65 [[nodiscard]] QString id() const;
66
67 /**
68 * @brief Sets account email.
69 *
70 * @param email
71 */
72 void setEmail(const QString &email);
73
74 /**
75 * @brief Returns account email address.
76 *
77 * Note that address does not have to be \@gmail.com.
78 */
79 [[nodiscard]] QString email() const;
80
81 /**
82 * @brief Sets user's real full name.
83 *
84 * @param name
85 */
86 void setName(const QString &name);
87
88 /**
89 * @brief Returns user's real full name.
90 */
91 [[nodiscard]] QString name() const;
92
93 /**
94 * @brief Sets user's given name.
95 *
96 * @param givenName
97 */
98 void setGivenName(const QString &givenName);
99
100 /**
101 * @brief Returns user's given name.
102 */
103 [[nodiscard]] QString givenName() const;
104
105 /**
106 * @brief Sets user's family name (surname).
107 *
108 * @param familyName
109 */
110 void setFamilyName(const QString &familyName);
111
112 /**
113 * @brief Returns user's surname.
114 */
115 [[nodiscard]] QString familyName() const;
116
117 /**
118 * @brief Sets user's birthday
119 *
120 * @param birthday
121 */
122 void setBirthday(const QString &birthday);
123
124 /**
125 * @brief Returns user's birthday.
126 */
127 [[nodiscard]] QString birthday() const;
128
129 /**
130 * @brief Sets user's gender.
131 *
132 * @param gender
133 */
134 void setGender(const QString &gender);
135
136 /**
137 * @brief Returns user's gender.
138 */
139 [[nodiscard]] QString gender() const;
140
141 /**
142 * @brief Sets link to user's profile.
143 *
144 * @param link
145 */
146 void setLink(const QString &link);
147
148 /**
149 * @brief Returns link to user's profile.
150 */
151 [[nodiscard]] QString link() const;
152
153 /**
154 * @brief Sets users locale settings.
155 *
156 * @param locale
157 */
158 void setLocale(const QString &locale);
159
160 /**
161 * @brief Returns user's preferred locales.
162 */
163 [[nodiscard]] QString locale() const;
164
165 /**
166 * @brief Sets user's timezone name.
167 *
168 * @param timezone
169 */
170 void setTimezone(const QString &timezone);
171
172 /**
173 * @brief Returns name of user's timezone.
174 */
175 [[nodiscard]] QString timezone() const;
176
177 /**
178 * @brief Sets whether the email address is verified.
179 *
180 * @param verified
181 */
182 void setVerifiedEmail(bool verified);
183
184 /**
185 * @brief Returns whether the email is verified.
186 */
187 [[nodiscard]] bool verifiedEmail() const;
188
189 /**
190 * @brief Sets URL of user's photo.
191 *
192 * @param url
193 */
194 void setPhotoUrl(const QString &url);
195
196 /**
197 * @brief Returns URL of user's photo.
198 */
199 [[nodiscard]] QString photoUrl() const;
200
201 /**
202 * @brief Parses raw JSON data into AccountInfo object.
203 *
204 * @param jsonData JSON data to parse
205 */
206 static AccountInfoPtr fromJSON(const QByteArray &jsonData);
207
208private:
209 class Private;
210 Private *const d;
211 friend class Private;
212};
213
214} // namespace KGAPI2
void setLink(const QString &link)
Sets link to user's profile.
QString link() const
Returns link to user's profile.
void setFamilyName(const QString &familyName)
Sets user's family name (surname).
void setEmail(const QString &email)
Sets account email.
void setPhotoUrl(const QString &url)
Sets URL of user's photo.
void setVerifiedEmail(bool verified)
Sets whether the email address is verified.
QString email() const
Returns account email address.
void setLocale(const QString &locale)
Sets users locale settings.
void setGender(const QString &gender)
Sets user's gender.
AccountInfo()
Constructor.
QString name() const
Returns user's real full name.
QString givenName() const
Returns user's given name.
QString familyName() const
Returns user's surname.
void setBirthday(const QString &birthday)
Sets user's birthday.
void setId(const QString &id)
Sets an account ID.
void setGivenName(const QString &givenName)
Sets user's given name.
QString gender() const
Returns user's gender.
QString id() const
Returns account ID.
void setTimezone(const QString &timezone)
Sets user's timezone name.
void setName(const QString &name)
Sets user's real full name.
QString photoUrl() const
Returns URL of user's photo.
static AccountInfoPtr fromJSON(const QByteArray &jsonData)
Parses raw JSON data into AccountInfo object.
bool verifiedEmail() const
Returns whether the email is verified.
QString locale() const
Returns user's preferred locales.
QString timezone() const
Returns name of user's timezone.
QString birthday() const
Returns user's birthday.
Base class for all objects.
Definition object.h:31
A job to fetch a single map tile described by a StaticMapUrl.
Definition blog.h:16
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:57:30 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.