libquentier  0.5.0
The library for rich desktop clients of Evernote service
INoteStore.h
1 /*
2  * Copyright 2018-2020 Dmitry Ivanov
3  *
4  * This file is part of libquentier
5  *
6  * libquentier is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU Lesser General Public License as published by
8  * the Free Software Foundation, version 3 of the License.
9  *
10  * libquentier is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with libquentier. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef LIB_QUENTIER_SYNCHRONIZATION_I_NOTE_STORE_H
20 #define LIB_QUENTIER_SYNCHRONIZATION_I_NOTE_STORE_H
21 
22 #include <quentier/synchronization/ForwardDeclarations.h>
23 #include <quentier/types/ErrorString.h>
24 #include <quentier/types/Note.h>
25 #include <quentier/types/Notebook.h>
26 #include <quentier/types/SavedSearch.h>
27 #include <quentier/types/Tag.h>
28 #include <quentier/utility/Linkage.h>
29 
30 #include <qt5qevercloud/QEverCloud.h>
31 
32 #include <QObject>
33 
34 #include <memory>
35 
36 namespace quentier {
37 
43 class QUENTIER_EXPORT INoteStore : public QObject
44 {
45  Q_OBJECT
46 protected:
47  explicit INoteStore(QObject * parent = nullptr);
48 
49 public:
50  virtual ~INoteStore() = default;
51 
52  /*
53  * Factory method, create a new INoteStore subclass object
54  */
55  virtual INoteStore * create() const = 0;
56 
60  virtual QString noteStoreUrl() const = 0;
61 
65  virtual void setNoteStoreUrl(QString noteStoreUrl) = 0;
66 
70  virtual void setAuthData(
71  QString authenticationToken, QList<QNetworkCookie> cookies) = 0;
72 
77  virtual void stop() = 0;
78 
102  virtual qint32 createNotebook(
103  Notebook & notebook, ErrorString & errorDescription,
104  qint32 & rateLimitSeconds, QString linkedNotebookAuthToken = {}) = 0;
105 
127  virtual qint32 updateNotebook(
128  Notebook & notebook, ErrorString & errorDescription,
129  qint32 & rateLimitSeconds, QString linkedNotebookAuthToken = {}) = 0;
130 
151  virtual qint32 createNote(
152  Note & note, ErrorString & errorDescription, qint32 & rateLimitSeconds,
153  QString linkedNotebookAuthToken = {}) = 0;
154 
176  virtual qint32 updateNote(
177  Note & note, ErrorString & errorDescription, qint32 & rateLimitSeconds,
178  QString linkedNotebookAuthToken = {}) = 0;
179 
201  virtual qint32 createTag(
202  Tag & tag, ErrorString & errorDescription, qint32 & rateLimitSeconds,
203  QString linkedNotebookAuthToken = {}) = 0;
204 
226  virtual qint32 updateTag(
227  Tag & tag, ErrorString & errorDescription, qint32 & rateLimitSeconds,
228  QString linkedNotebookAuthToken = {}) = 0;
229 
247  virtual qint32 createSavedSearch(
248  SavedSearch & savedSearch, ErrorString & errorDescription,
249  qint32 & rateLimitSeconds) = 0;
250 
267  virtual qint32 updateSavedSearch(
268  SavedSearch & savedSearch, ErrorString & errorDescription,
269  qint32 & rateLimitSeconds) = 0;
270 
287  virtual qint32 getSyncState(
288  qevercloud::SyncState & syncState, ErrorString & errorDescription,
289  qint32 & rateLimitSeconds) = 0;
290 
313  virtual qint32 getSyncChunk(
314  const qint32 afterUSN, const qint32 maxEntries,
315  const qevercloud::SyncChunkFilter & filter,
316  qevercloud::SyncChunk & syncChunk, ErrorString & errorDescription,
317  qint32 & rateLimitSeconds) = 0;
318 
344  const qevercloud::LinkedNotebook & linkedNotebook,
345  const QString & authToken, qevercloud::SyncState & syncState,
346  ErrorString & errorDescription, qint32 & rateLimitSeconds) = 0;
347 
385  const qevercloud::LinkedNotebook & linkedNotebook,
386  const qint32 afterUSN, const qint32 maxEntries,
387  const QString & linkedNotebookAuthToken, const bool fullSyncOnly,
388  qevercloud::SyncChunk & syncChunk, ErrorString & errorDescription,
389  qint32 & rateLimitSeconds) = 0;
390 
421  virtual qint32 getNote(
422  const bool withContent, const bool withResourcesData,
423  const bool withResourcesRecognition,
424  const bool withResourceAlternateData, Note & note,
425  ErrorString & errorDescription, qint32 & rateLimitSeconds) = 0;
426 
464  virtual bool getNoteAsync(
465  const bool withContent, const bool withResourceData,
466  const bool withResourcesRecognition,
467  const bool withResourceAlternateData, const bool withSharedNotes,
468  const bool withNoteAppDataValues, const bool withResourceAppDataValues,
469  const bool withNoteLimits, const QString & noteGuid,
470  const QString & authToken, ErrorString & errorDescription) = 0;
471 
503  virtual qint32 getResource(
504  const bool withDataBody, const bool withRecognitionDataBody,
505  const bool withAlternateDataBody, const bool withAttributes,
506  const QString & authToken, Resource & resource,
507  ErrorString & errorDescription, qint32 & rateLimitSeconds) = 0;
508 
533  virtual bool getResourceAsync(
534  const bool withDataBody, const bool withRecognitionDataBody,
535  const bool withAlternateDataBody, const bool withAttributes,
536  const QString & resourceGuid, const QString & authToken,
537  ErrorString & errorDescription) = 0;
538 
559  const QString & shareKey, qevercloud::AuthenticationResult & authResult,
560  ErrorString & errorDescription, qint32 & rateLimitSeconds) = 0;
561 
562 Q_SIGNALS:
563  void getNoteAsyncFinished(
564  qint32 errorCode, qevercloud::Note note, qint32 rateLimitSeconds,
565  ErrorString errorDescription);
566 
567  void getResourceAsyncFinished(
568  qint32 errorCode, qevercloud::Resource resource,
569  qint32 rateLimitSeconds, ErrorString errorDescription);
570 
571 private:
572  Q_DISABLE_COPY(INoteStore)
573 };
574 
575 QUENTIER_EXPORT INoteStorePtr newNoteStore(QObject * parent = nullptr);
576 
577 } // namespace quentier
578 
579 #endif // LIB_QUENTIER_SYNCHRONIZATION_I_NOTE_STORE_H
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:44
INoteStore is the interface which provides methods required for the implementation of NoteStore part ...
Definition: INoteStore.h:44
virtual qint32 updateTag(Tag &tag, ErrorString &errorDescription, qint32 &rateLimitSeconds, QString linkedNotebookAuthToken={})=0
virtual qint32 updateSavedSearch(SavedSearch &savedSearch, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual QString noteStoreUrl() const =0
virtual qint32 getNote(const bool withContent, const bool withResourcesData, const bool withResourcesRecognition, const bool withResourceAlternateData, Note &note, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual void setNoteStoreUrl(QString noteStoreUrl)=0
virtual qint32 authenticateToSharedNotebook(const QString &shareKey, qevercloud::AuthenticationResult &authResult, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual void setAuthData(QString authenticationToken, QList< QNetworkCookie > cookies)=0
virtual bool getNoteAsync(const bool withContent, const bool withResourceData, const bool withResourcesRecognition, const bool withResourceAlternateData, const bool withSharedNotes, const bool withNoteAppDataValues, const bool withResourceAppDataValues, const bool withNoteLimits, const QString &noteGuid, const QString &authToken, ErrorString &errorDescription)=0
virtual qint32 createNotebook(Notebook &notebook, ErrorString &errorDescription, qint32 &rateLimitSeconds, QString linkedNotebookAuthToken={})=0
virtual qint32 getResource(const bool withDataBody, const bool withRecognitionDataBody, const bool withAlternateDataBody, const bool withAttributes, const QString &authToken, Resource &resource, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual qint32 getSyncState(qevercloud::SyncState &syncState, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual qint32 createSavedSearch(SavedSearch &savedSearch, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual qint32 updateNote(Note &note, ErrorString &errorDescription, qint32 &rateLimitSeconds, QString linkedNotebookAuthToken={})=0
virtual void stop()=0
virtual qint32 getSyncChunk(const qint32 afterUSN, const qint32 maxEntries, const qevercloud::SyncChunkFilter &filter, qevercloud::SyncChunk &syncChunk, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual qint32 getLinkedNotebookSyncChunk(const qevercloud::LinkedNotebook &linkedNotebook, const qint32 afterUSN, const qint32 maxEntries, const QString &linkedNotebookAuthToken, const bool fullSyncOnly, qevercloud::SyncChunk &syncChunk, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual qint32 getLinkedNotebookSyncState(const qevercloud::LinkedNotebook &linkedNotebook, const QString &authToken, qevercloud::SyncState &syncState, ErrorString &errorDescription, qint32 &rateLimitSeconds)=0
virtual qint32 updateNotebook(Notebook &notebook, ErrorString &errorDescription, qint32 &rateLimitSeconds, QString linkedNotebookAuthToken={})=0
virtual qint32 createNote(Note &note, ErrorString &errorDescription, qint32 &rateLimitSeconds, QString linkedNotebookAuthToken={})=0
virtual qint32 createTag(Tag &tag, ErrorString &errorDescription, qint32 &rateLimitSeconds, QString linkedNotebookAuthToken={})=0
virtual bool getResourceAsync(const bool withDataBody, const bool withRecognitionDataBody, const bool withAlternateDataBody, const bool withAttributes, const QString &resourceGuid, const QString &authToken, ErrorString &errorDescription)=0
Definition: Note.h:35
Definition: Notebook.h:35
Definition: Resource.h:30
Definition: SavedSearch.h:33
Definition: Tag.h:33