KGAPI2::Account

Search for usage in LXR

#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< 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 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.

Author
Daniel Vrátil dvrat.nosp@m.il@r.nosp@m.edhat.nosp@m..com
Since
0.1

Definition at line 39 of file account.h.

Constructor & Destructor Documentation

◆ Account() [1/3]

Account::Account ( )

Constructs an invalid account.

Definition at line 41 of file account.cpp.

◆ Account() [2/3]

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

Constructs a new valid account.

Parameters
accountGoogle account name (usually user..nosp@m.name.nosp@m.@gmai.nosp@m.l.co.nosp@m.m)
accessTokenAccess token to scopes for account
refreshTokenRefresh token
scopesList 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()

Account::~Account ( )
virtual

Destructor.

Definition at line 63 of file account.cpp.

Member Function Documentation

◆ accessToken()

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

Definition at line 93 of file account.cpp.

◆ accountInfoEmailScopeUrl()

QUrl Account::accountInfoEmailScopeUrl ( )
static

Returns scope URL to retrieve AccountInfo with email.

Definition at line 155 of file account.cpp.

◆ accountInfoScopeUrl()

QUrl Account::accountInfoScopeUrl ( )
static

Returns scope URL for AccountInfo service.

Definition at line 150 of file account.cpp.

◆ accountName()

QString Account::accountName ( ) const
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()

QUrl Account::bloggerScopeUrl ( )
static

Returns scope URL for Google Blogger service.

Definition at line 180 of file account.cpp.

◆ calendarScopeUrl()

QUrl Account::calendarScopeUrl ( )
static

Returns scope URL for Google Calendar service.

Definition at line 160 of file account.cpp.

◆ driveScopeUrl()

QUrl Account::driveScopeUrl ( )
static

Returns scope URL for Drive service.

Definition at line 190 of file account.cpp.

◆ expireDateTime()

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

Definition at line 140 of file account.cpp.

◆ latitudeScopeUrl()

QUrl Account::latitudeScopeUrl ( )
static

Returns scope URL for Google Latitude service.

Definition at line 170 of file account.cpp.

◆ mailScopeUrl()

QUrl Account::mailScopeUrl ( )
static

Returns scope URL for Gmail service.

Definition at line 185 of file account.cpp.

◆ operator==()

bool Account::operator== ( const Account & other) const

Definition at line 68 of file account.cpp.

◆ peopleScopeUrl()

QUrl Account::peopleScopeUrl ( )
static

Returns scope URL for Google People service.

Definition at line 165 of file account.cpp.

◆ refreshToken()

QString Account::refreshToken ( ) const
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()

QList< QUrl > Account::scopes ( ) const
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)

Sets a new access token.

Parameters
accessToken

Definition at line 98 of file account.cpp.

◆ setAccountName()

void Account::setAccountName ( const QString & accountName)

Sets account name.

Parameters
accountName

Definition at line 88 of file account.cpp.

◆ 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()

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

◆ tasksScopeUrl()

QUrl Account::tasksScopeUrl ( )
static

Returns scope URL for Google Tasks service.

Definition at line 175 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-2024 The KDE developers.
Generated on Sat Apr 27 2024 22:14:20 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.