nextnote.h 1.14 KB
Newer Older
1 2 3 4 5 6
#ifndef NEXTNOTE_H
#define NEXTNOTE_H

#include <QObject>
#include <QString>
#include "abstractnotessyncer.h"
7
#include<functional>
8 9 10 11 12 13 14 15 16 17 18
/**
 * @brief The NextNote class follows the NextCloud API specification
 *  for syncing notes.
 */

class NextNote : public AbstractNotesSyncer
{
    Q_OBJECT
public:
    explicit NextNote(QObject *parent = nullptr);
    ~NextNote();
19
    void getNote(const QString &id) override final;
20
    void getNotes() override final;
21 22 23
    void insertNote(const FMH::MODEL &note) override final;
    void updateNote(const QString &id, const FMH::MODEL &note) override final;
    void removeNote(const QString &id) override final;
24 25

private:
26
    const static QString API;
27
    static QString formatUrl(const QString &user, const QString &password, const QString &provider);
28
    static FMH::MODEL_LIST parseNotes(const QByteArray &array);
29

30 31 32
//    template<typename T>
//    void request(const QString &url, const QMap<QString, QString> &header, T cb);
//    void request(const QString &url, const QMap<QString, QString> &header,  std::function<void (QByteArray)>cb);
33 34 35 36

signals:

public slots:
37
    void sendNotes(QByteArray array);
38 39 40
};

#endif // NEXTNOTE_H