libquentier  0.5.0
The library for rich desktop clients of Evernote service
INoteStore.h
1 /*
2  * Copyright 2018-2019 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_PRIVATE_SYNCHRONIZATION_I_NOTE_STORE_H
20 #define LIB_QUENTIER_PRIVATE_SYNCHRONIZATION_I_NOTE_STORE_H
21 
22 #include <quentier/types/Notebook.h>
23 #include <quentier/types/Note.h>
24 #include <quentier/types/Tag.h>
25 #include <quentier/types/SavedSearch.h>
26 #include <quentier/types/ErrorString.h>
27 #include <quentier/utility/Linkage.h>
28 #include <quentier/utility/Macros.h>
29 
30 #include <qt5qevercloud/QEverCloud.h>
31 
32 #include <QObject>
33 #include <QSharedPointer>
34 
35 namespace quentier {
36 
49 class QUENTIER_EXPORT INoteStore: public QObject
50 {
51  Q_OBJECT
52 protected:
53  explicit INoteStore(
54  const qevercloud::INoteStorePtr & pQecNoteStore,
55  QObject * parent = nullptr);
56 
57 public:
58  virtual ~INoteStore();
59 
60  qevercloud::INoteStorePtr getQecNoteStore();
61  void setQecNoteStore(const qevercloud::INoteStorePtr & pQecNoteStore);
62 
63  QString noteStoreUrl() const;
64  void setNoteStoreUrl(const QString & noteStoreUrl);
65 
66  QString authenticationToken() const;
67  void setAuthenticationToken(const QString & authToken);
68 
69 public:
73  virtual INoteStore * create() const = 0;
74 
78  virtual void stop() = 0;
79 
101  virtual qint32 createNotebook(
102  Notebook & notebook, ErrorString & errorDescription,
103  qint32 & rateLimitSeconds,
104  const QString & linkedNotebookAuthToken = QString()) = 0;
105 
125  virtual qint32 updateNotebook(
126  Notebook & notebook, ErrorString & errorDescription,
127  qint32 & rateLimitSeconds,
128  const QString & linkedNotebookAuthToken = QString()) = 0;
129 
149  virtual qint32 createNote(
150  Note & note, ErrorString & errorDescription, qint32 & rateLimitSeconds,
151  const QString & linkedNotebookAuthToken = QString()) = 0;
152 
172  virtual qint32 updateNote(
173  Note & note, ErrorString & errorDescription, qint32 & rateLimitSeconds,
174  const QString & linkedNotebookAuthToken = QString()) = 0;
175 
196  virtual qint32 createTag(
197  Tag & tag, ErrorString & errorDescription, qint32 & rateLimitSeconds,
198  const QString & linkedNotebookAuthToken = QString()) = 0;
199 
219  virtual qint32 updateTag(
220  Tag & tag, ErrorString & errorDescription, qint32 & rateLimitSeconds,
221  const QString & linkedNotebookAuthToken = QString()) = 0;
222 
239  virtual qint32 createSavedSearch(
240  SavedSearch & savedSearch, ErrorString & errorDescription,
241  qint32 & rateLimitSeconds) = 0;
242 
258  virtual qint32 updateSavedSearch(
259  SavedSearch & savedSearch, ErrorString & errorDescription,
260  qint32 & rateLimitSeconds) = 0;
261 
277  virtual qint32 getSyncState(
278  qevercloud::SyncState & syncState, ErrorString & errorDescription,
279  qint32 & rateLimitSeconds) = 0;
280 
302  virtual qint32 getSyncChunk(
303  const qint32 afterUSN, const qint32 maxEntries,
304  const qevercloud::SyncChunkFilter & filter,
305  qevercloud::SyncChunk & syncChunk, ErrorString & errorDescription,
306  qint32 & rateLimitSeconds) = 0;
307 
328  virtual qint32 getLinkedNotebookSyncState(
329  const qevercloud::LinkedNotebook & linkedNotebook,
330  const QString & authToken, qevercloud::SyncState & syncState,
331  ErrorString & errorDescription, qint32 & rateLimitSeconds) = 0;
332 
367  virtual qint32 getLinkedNotebookSyncChunk(
368  const qevercloud::LinkedNotebook & linkedNotebook,
369  const qint32 afterUSN, const qint32 maxEntries,
370  const QString & linkedNotebookAuthToken,
371  const bool fullSyncOnly,
372  qevercloud::SyncChunk & syncChunk,
373  ErrorString & errorDescription,
374  qint32 & rateLimitSeconds) = 0;
375 
404  virtual qint32 getNote(
405  const bool withContent, const bool withResourcesData,
406  const bool withResourcesRecognition,
407  const bool withResourceAlternateData,
408  Note & note, ErrorString & errorDescription,
409  qint32 & rateLimitSeconds) = 0;
410 
445  virtual bool getNoteAsync(
446  const bool withContent,
447  const bool withResourceData,
448  const bool withResourcesRecognition,
449  const bool withResourceAlternateData,
450  const bool withSharedNotes,
451  const bool withNoteAppDataValues,
452  const bool withResourceAppDataValues,
453  const bool withNoteLimits,
454  const QString & noteGuid,
455  const QString & authToken,
456  ErrorString & errorDescription) = 0;
457 
485  virtual qint32 getResource(
486  const bool withDataBody,
487  const bool withRecognitionDataBody,
488  const bool withAlternateDataBody,
489  const bool withAttributes,
490  const QString & authToken,
491  Resource & resource,
492  ErrorString & errorDescription,
493  qint32 & rateLimitSeconds) = 0;
494 
518  virtual bool getResourceAsync(
519  const bool withDataBody,
520  const bool withRecognitionDataBody,
521  const bool withAlternateDataBody,
522  const bool withAttributes,
523  const QString & resourceGuid,
524  const QString & authToken,
525  ErrorString & errorDescription) = 0;
526 
544  virtual qint32 authenticateToSharedNotebook(
545  const QString & shareKey, qevercloud::AuthenticationResult & authResult,
546  ErrorString & errorDescription, qint32 & rateLimitSeconds) = 0;
547 
548 Q_SIGNALS:
549  void getNoteAsyncFinished(
550  qint32 errorCode, qevercloud::Note note,
551  qint32 rateLimitSeconds, ErrorString errorDescription);
552 
553  void getResourceAsyncFinished(
554  qint32 errorCode, qevercloud::Resource resource,
555  qint32 rateLimitSeconds, ErrorString errorDescription);
556 
557 private:
558  Q_DISABLE_COPY(INoteStore)
559 
560 protected:
561  qevercloud::INoteStorePtr m_pQecNoteStore;
562  QString m_authenticationToken;
563 };
564 
565 } // namespace quentier
566 
567 #endif // LIB_QUENTIER_PRIVATE_SYNCHRONIZATION_I_NOTE_STORE_H
quentier::INoteStore
INoteStore is the interface for NoteStore used by SynchronizationManager: it provides signatures of m...
Definition: INoteStore.h:49
quentier::SavedSearch
Definition: SavedSearch.h:32
quentier::ErrorString
The ErrorString class encapsulates two (or more) strings which are meant to contain translatable (bas...
Definition: ErrorString.h:43
quentier::Notebook
Definition: Notebook.h:34
quentier::Tag
Definition: Tag.h:32
quentier::Resource
Definition: Resource.h:29
quentier::Note
Definition: Note.h:34