KGAPI2::Account

#include <account.h>

Public Member Functions

 Account ()
 
 Account (const QString &account, const QString &accessToken=QString(), const QString &refreshToken=QString(), const QList< QUrl > &scopes=QList< QUrl >())
 
 Account (const Account &other)
 
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< QUrlscopes () 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 calendarScopeUrl ()
 
static QUrl contactsScopeUrl ()
 
static QUrl driveScopeUrl ()
 
static QUrl latitudeScopeUrl ()
 
static QUrl mailScopeUrl ()
 
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.

Author
Daniel Vrátil dvrat[email protected][email protected][email protected]edhat[email protected].com
Since
0.1

Definition at line 40 of file account.h.

Constructor & Destructor Documentation

Account::Account ( )

Constructs an invalid account.

Definition at line 41 of file account.cpp.

Account::Account ( const QString account,
const QString accessToken = QString(),
const QString refreshToken = QString(),
const QList< QUrl > &  scopes = QListQUrl >() 
)
explicit

Constructs a new valid account.

Parameters
accountGoogle account name (usually user.[email protected]name[email protected]@gmai[email protected]l.co[email protected]m)
accessTokenAccess token to scopes for account
refreshTokenRefresh token
scopesList of scopes

Definition at line 47 of file account.cpp.

Account::Account ( const Account other)

Copy constructor.

Definition at line 58 of file account.cpp.

Account::~Account ( )
virtual

Destructor.

Definition at line 64 of file account.cpp.

Member Function Documentation

QString Account::accessToken ( ) const
Returns
Returns access token.

Definition at line 94 of file account.cpp.

QUrl Account::accountInfoEmailScopeUrl ( )
static

Returns scope URL to retrieve AccountInfo with email.

Definition at line 156 of file account.cpp.

QUrl Account::accountInfoScopeUrl ( )
static

Returns scope URL for AccountInfo service.

Definition at line 151 of file account.cpp.

QString Account::accountName ( ) const
Returns
Returns unique account identifier

Definition at line 84 of file account.cpp.

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 125 of file account.cpp.

QUrl Account::bloggerScopeUrl ( )
static

Returns scope URL for Google Blogger service.

Definition at line 181 of file account.cpp.

QUrl Account::calendarScopeUrl ( )
static

Returns scope URL for Google Calendar service.

Definition at line 161 of file account.cpp.

QUrl Account::contactsScopeUrl ( )
static

Returns scope URL for Google Contacts service.

Definition at line 166 of file account.cpp.

QUrl Account::driveScopeUrl ( )
static

Returns scope URL for Drive service.

Definition at line 191 of file account.cpp.

QDateTime Account::expireDateTime ( ) const
Since
2.0.82 Returns expire date time token

Definition at line 141 of file account.cpp.

QUrl Account::latitudeScopeUrl ( )
static

Returns scope URL for Google Latitude service.

Definition at line 171 of file account.cpp.

QUrl Account::mailScopeUrl ( )
static

Returns scope URL for Gmail service.

Definition at line 186 of file account.cpp.

QString Account::refreshToken ( ) const
Returns
Returns refresh token.

Definition at line 104 of file account.cpp.

void Account::removeScope ( const QUrl scope)

Removes scope from the list.

Parameters
scope
See also
Account::setScopes(const QList<QUrl>)

Definition at line 133 of file account.cpp.

QList< QUrl > Account::scopes ( ) const
Returns
Returns list of scopes the account is authenticated against.

Definition at line 114 of file account.cpp.

void Account::setAccessToken ( const QString accessToken)

Sets a new access token.

Parameters
accessToken

Definition at line 99 of file account.cpp.

void Account::setAccountName ( const QString accountName)

Sets account name.

Parameters
accountName

Definition at line 89 of file account.cpp.

void Account::setExpireDateTime ( const QDateTime expire)
Since
2.0.82 set expire date time

Definition at line 146 of file account.cpp.

void Account::setRefreshToken ( const QString refreshToken)

Sets a new refresh token for the access token.

Parameters
refreshToken

Definition at line 109 of file account.cpp.

void Account::setScopes ( const QList< QUrl > &  scopes)

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 119 of file account.cpp.

QUrl Account::tasksScopeUrl ( )
static

Returns scope URL for Google Tasks service.

Definition at line 176 of file account.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Aug 13 2020 23:09:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.