1 /*
2  * Copyright (C) by Roeland Jago Douma <roeland@owncloud.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
11  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12  * for more details.
13  */
14 
15 #include "ocsshareejob.h"
16 
17 #include <QJsonDocument>
18 
19 namespace OCC {
20 
OcsShareeJob(AccountPtr account)21 OcsShareeJob::OcsShareeJob(AccountPtr account)
22     : OcsJob(account)
23 {
24     setPath("ocs/v2.php/apps/files_sharing/api/v1/sharees");
25     connect(this, &OcsJob::jobFinished, this, &OcsShareeJob::jobDone);
26 }
27 
getSharees(const QString & search,const QString & itemType,int page,int perPage,bool lookup)28 void OcsShareeJob::getSharees(const QString &search,
29     const QString &itemType,
30     int page,
31     int perPage,
32     bool lookup)
33 {
34     setVerb("GET");
35 
36     addParam(QString::fromLatin1("search"), search);
37     addParam(QString::fromLatin1("itemType"), itemType);
38     addParam(QString::fromLatin1("page"), QString::number(page));
39     addParam(QString::fromLatin1("perPage"), QString::number(perPage));
40     addParam(QString::fromLatin1("lookup"), QVariant(lookup).toString());
41 
42     start();
43 }
44 
jobDone(const QJsonDocument & reply)45 void OcsShareeJob::jobDone(const QJsonDocument &reply)
46 {
47     emit shareeJobFinished(reply);
48 }
49 }
50