KGAPI2::Account
#include <account.h>
Public Member Functions | |
Account () | |
Account (const Account &other) | |
Account (const QString &account, const QString &accessToken=QString(), const QString &refreshToken=QString(), const QList< QUrl > &scopes=QList< QUrl >()) | |
virtual | ~Account () |
QString | accessToken () const |
QString | accountName () const |
void | addScope (const QUrl &scope) |
QDateTime | expireDateTime () const |
bool | operator== (const Account &other) const |
QString | refreshToken () const |
void | removeScope (const QUrl &scope) |
QList< QUrl > | scopes () const |
void | setAccessToken (const QString &accessToken) |
void | setAccountName (const QString &accountName) |
void | setExpireDateTime (const QDateTime &expire) |
void | setRefreshToken (const QString &refreshToken) |
void | setScopes (const QList< QUrl > &scopes) |
Static Public Member Functions | |
static QUrl | accountInfoEmailScopeUrl () |
static QUrl | accountInfoScopeUrl () |
static QUrl | bloggerScopeUrl () |
static QUrl | calendarEventsScopeUrl () |
static QUrl | calendarScopeUrl () |
static QUrl | driveScopeUrl () |
static QUrl | latitudeScopeUrl () |
static QUrl | mailScopeUrl () |
static QUrl | peopleScopeUrl () |
static QUrl | tasksScopeUrl () |
Detailed Description
A Google account.
This class represents a single Google account. The account is uniquely identified by Account::accountName (which is actually the user's GMail address).
The class stores an access token, refresh token (to retrieve a new access token when the old one expires) and list of scopes (APIs that current access token can be used to access).
Unlike in previous versions, account management is not handled by LibKGAPI anymore and it's up to programmer to store the account in a persistent storage.
To obtain a new account, use AuthJob.
- Since
- 0.1
Constructor & Destructor Documentation
◆ Account() [1/3]
Account::Account | ( | ) |
Constructs an invalid account.
Definition at line 41 of file account.cpp.
◆ Account() [2/3]
|
explicit |
Constructs a new valid account.
- Parameters
-
account Google account name (usually user..nosp@m.name.nosp@m.@gmai.nosp@m.l.co.nosp@m.m) accessToken Access token to scopes
foraccount
refreshToken Refresh token scopes List of scopes
Definition at line 47 of file account.cpp.
◆ Account() [3/3]
Account::Account | ( | const Account & | other | ) |
Copy constructor.
Definition at line 57 of file account.cpp.
◆ ~Account()
|
virtual |
Destructor.
Definition at line 63 of file account.cpp.
Member Function Documentation
◆ accessToken()
|
nodiscard |
- Returns
- Returns access token.
Definition at line 93 of file account.cpp.
◆ accountInfoEmailScopeUrl()
|
static |
Returns scope URL to retrieve AccountInfo with email.
Definition at line 155 of file account.cpp.
◆ accountInfoScopeUrl()
|
static |
Returns scope URL for AccountInfo service.
Definition at line 150 of file account.cpp.
◆ accountName()
|
nodiscard |
- Returns
- Returns unique account identifier
Definition at line 83 of file account.cpp.
◆ addScope()
void Account::addScope | ( | const QUrl & | scope | ) |
Adds a single scope to account scopes.
- Parameters
-
scope
- See also
- Account::setScopes(const QList<QUrl>)
Definition at line 124 of file account.cpp.
◆ bloggerScopeUrl()
|
static |
Returns scope URL for Google Blogger service.
Definition at line 185 of file account.cpp.
◆ calendarEventsScopeUrl()
|
static |
Returns scope URL for accessing Google Calendar events.
Definition at line 165 of file account.cpp.
◆ calendarScopeUrl()
|
static |
Returns scope URL for accessing calendars in Google Calendar.
Definition at line 160 of file account.cpp.
◆ driveScopeUrl()
|
static |
Returns scope URL for Drive service.
Definition at line 195 of file account.cpp.
◆ expireDateTime()
|
nodiscard |
- Since
- 2.0.82 Returns expire date time token
Definition at line 140 of file account.cpp.
◆ latitudeScopeUrl()
|
static |
Returns scope URL for Google Latitude service.
Definition at line 175 of file account.cpp.
◆ mailScopeUrl()
|
static |
Returns scope URL for Gmail service.
Definition at line 190 of file account.cpp.
◆ operator==()
bool Account::operator== | ( | const Account & | other | ) | const |
Definition at line 68 of file account.cpp.
◆ peopleScopeUrl()
|
static |
Returns scope URL for Google People service.
Definition at line 170 of file account.cpp.
◆ refreshToken()
|
nodiscard |
- Returns
- Returns refresh token.
Definition at line 103 of file account.cpp.
◆ removeScope()
void Account::removeScope | ( | const QUrl & | scope | ) |
Removes scope from the list.
- Parameters
-
scope
- See also
- Account::setScopes(const QList<QUrl>)
Definition at line 132 of file account.cpp.
◆ scopes()
- Returns
- Returns list of scopes the account is authenticated against.
Definition at line 113 of file account.cpp.
◆ setAccessToken()
void Account::setAccessToken | ( | const QString & | accessToken | ) |
◆ setAccountName()
void Account::setAccountName | ( | const QString & | accountName | ) |
◆ setExpireDateTime()
void Account::setExpireDateTime | ( | const QDateTime & | expire | ) |
- Since
- 2.0.82 set expire date time
Definition at line 145 of file account.cpp.
◆ setRefreshToken()
void Account::setRefreshToken | ( | const QString & | refreshToken | ) |
Sets a new refresh token for the access token.
- Parameters
-
refreshToken
Definition at line 108 of file account.cpp.
◆ setScopes()
Sets new scopes.
- Note
- Note that changing scopes requires makes current tokens invalid. This means that when this Account is used next time, AuthJob will be automatically started and user will be prompted with a dialog to grant access to all scopes.
- Parameters
-
scopes
Definition at line 118 of file account.cpp.
◆ tasksScopeUrl()
|
static |
Returns scope URL for Google Tasks service.
Definition at line 180 of file account.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:36:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.