QEverCloud  3.0.0
Unofficial Evernote Cloud API for Qt
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Classes | Public Member Functions | List of all members
qevercloud::Thumbnail Class Reference

The class is for downloading thumbnails for notes and resources from Evernote servers. More...

#include <thumbnail.h>

Classes

struct  ImageType
 

Public Member Functions

 Thumbnail ()
 Default constructor. More...
 
 Thumbnail (QString host, QString shardId, QString authenticationToken, int size=300, ImageType::type imageType=ImageType::PNG)
 Constructs Thumbnail. More...
 
virtual ~Thumbnail ()
 
ThumbnailsetHost (QString host)
 
ThumbnailsetShardId (QString shardId)
 
ThumbnailsetAuthenticationToken (QString authenticationToken)
 
ThumbnailsetSize (int size)
 
ThumbnailsetImageType (ImageType::type imageType)
 
QByteArray download (Guid guid, bool isPublic=false, bool isResourceGuid=false)
 Downloads the thumbnail for a resource or a note. More...
 
AsyncResultdownloadAsync (Guid guid, bool isPublic=false, bool isResourceGuid=false)
 
QPair< QNetworkRequest,
QByteArray > 
createPostRequest (qevercloud::Guid guid, bool isPublic=false, bool isResourceGuid=false)
 Prepares a POST request for a thumbnail download. More...
 

Detailed Description

The class is for downloading thumbnails for notes and resources from Evernote servers.

These thumbnails are not available with general EDAM Thrift interface as explained in the documentation.

Usage:

Thumbnail thumb("www.evernote.com", sharId, authenticationToken);
QByteArray pngImage = thumb.download(noteGuid);

By defualt 300x300 PNG images are requested.

Constructor & Destructor Documentation

qevercloud::Thumbnail::Thumbnail ( )

Default constructor.

host, shardId, authenticationToken have to be specified before calling download or createPostRequest

qevercloud::Thumbnail::Thumbnail ( QString  host,
QString  shardId,
QString  authenticationToken,
int  size = 300,
ImageType::type  imageType = ImageType::PNG 
)

Constructs Thumbnail.

Parameters
hostwww.evernote.com or sandbox.evernote.com
shardIdYou can get the value from UserStore service or as a result of an authentication.
authenticationTokenFor working privite notes/resources you must supply a valid authentication token. For public resources the value specified is not used.
sizeThe size of the thumbnail. Evernote supports values from from 1 to 300. By defualt 300 is used.
imageTypeThumbnail image type. See ImageType. By default PNG is used.
virtual qevercloud::Thumbnail::~Thumbnail ( )
virtual

Member Function Documentation

QPair<QNetworkRequest, QByteArray> qevercloud::Thumbnail::createPostRequest ( qevercloud::Guid  guid,
bool  isPublic = false,
bool  isResourceGuid = false 
)

Prepares a POST request for a thumbnail download.

Parameters
guidThe note or resource guid
isPublicSpecify true for public notes/resources. In this case authentication token is not sent to with the request as it shoud be according to the docs.
isResourceGuidtrue if guid denotes a resource and false if it denotes a note.
Returns
a pair of QNetworkRequest for the POST request and data that must be posted with the request.
QByteArray qevercloud::Thumbnail::download ( Guid  guid,
bool  isPublic = false,
bool  isResourceGuid = false 
)

Downloads the thumbnail for a resource or a note.

Parameters
guidThe note or resource guid
isPublicSpecify true for public notes/resources. In this case authentication token is not sent to with the request as it shoud be according to the docs.
isResourceGuidtrue if guid denotes a resource and false if it denotes a note.
Returns
downloaded data.
AsyncResult* qevercloud::Thumbnail::downloadAsync ( Guid  guid,
bool  isPublic = false,
bool  isResourceGuid = false 
)

Asynchronous version of download function

Thumbnail& qevercloud::Thumbnail::setAuthenticationToken ( QString  authenticationToken)
Parameters
authenticationTokenFor working privite notes/resources you must supply a valid authentication token. For public resources the value specified is not used.
Thumbnail& qevercloud::Thumbnail::setHost ( QString  host)
Parameters
hostwww.evernote.com or sandbox.evernote.com
Thumbnail& qevercloud::Thumbnail::setImageType ( ImageType::type  imageType)
Parameters
imageTypeThumbnail image type. See ImageType. By default PNG is used.
Thumbnail& qevercloud::Thumbnail::setShardId ( QString  shardId)
Parameters
shardIdYou can get the value from UserStore service or as a result of an authentication.
Thumbnail& qevercloud::Thumbnail::setSize ( int  size)
Parameters
sizeThe size of the thumbnail. Evernote supports values from from 1 to 300. By defualt 300 is used.