nextcloud-desktop/src/gui/ocssharejob.h

108 lines
2.6 KiB
C
Raw Normal View History

/*
* Copyright (C) by Roeland Jago Douma <roeland@famdouma.nl>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef OCSSHAREJOB_H
#define OCSSHAREJOB_H
#include "ocsjob.h"
#include <QVector>
#include <QList>
#include <QPair>
namespace OCC {
/**
* @brief The OcsShareJob class
* @ingroup gui
2015-10-15 21:54:52 +03:00
*
* Handle talking to the OCS Share API.
* For creation, deletion and modification of shares.
*/
2015-10-15 21:54:52 +03:00
class OcsShareJob : public OcsJob {
Q_OBJECT
public:
/**
* Support sharetypes
*/
enum class SHARETYPE : int {
LINK = 3
};
2015-10-16 09:09:57 +03:00
/**
* Possible permissions
*/
enum class PERMISSION : int {
READ = 1,
UPDATE = 2,
CREATE = 4,
DELETE = 8,
SHARE = 16,
ALL = 31
};
/**
* Constructor for new shares or listing of shares
*/
explicit OcsShareJob(AccountPtr account, QObject *parent = 0);
/**
* Get all the shares
*
* @param path Path to request shares for (default all shares)
*/
void getShares(const QString& path = "");
/**
* Delete the current Share
*/
void deleteShare(int shareId);
/**
* Set the expiration date of a share
*
* @param date The expire date, if this date is invalid the expire date
* will be removed
*/
void setExpireDate(int shareId, const QDate& date);
/**
* Set the password of a share
*
* @param password The password of the share, if the password is empty the
* share will be removed
*/
void setPassword(int shareId, const QString& password);
2015-10-15 21:34:56 +03:00
/**
2015-10-16 13:51:24 +03:00
* Void set the share to be public upload
2015-10-15 21:34:56 +03:00
*
* @param publicUpload Set or remove public upload
*/
void setPublicUpload(int shareId, bool publicUpload);
2015-10-15 21:34:56 +03:00
/**
* Create a new share
*
* @param path The path of the file/folder to share
* @param shareType The type of share (user/group/link/federated)
* @param password Optionally a password for the share
* @param date Optionally an expire date for the share
*/
void createShare(const QString& path, SHARETYPE shareType, const QString& password = "", const QDate& date = QDate());
};
}
#endif // OCSSHAREJOB_H