1 /* 2 3 Copyright 2011 Cuong Le <metacuong@gmail.com> 4 5 This program is free software; you can redistribute it and/or 6 modify it under the terms of the GNU General Public License as 7 published by the Free Software Foundation; either version 2 of 8 the License, or (at your option) any later version. 9 10 This program 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 General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 18 */ 19 20 #ifndef DROPRESTAPI_H 21 #define DROPRESTAPI_H 22 23 #include "oauth.h" 24 25 #include <QNetworkRequest> 26 #include <QNetworkReply> 27 #include <QByteArray> 28 #include <QUrl> 29 30 #define REQUEST_TOKEN_URL "https://api.dropbox.com/1/oauth/request_token" 31 #define REQUEST_ACCESS_TOKEN "https://api.dropbox.com/1/oauth/access_token" 32 33 #define FILES_URL "https://api.dropbox.com/1/metadata/dropbox" 34 #define FILES_TRANSFER_URL "https://api-content.dropbox.com/1/files/dropbox" 35 36 #define FILE_DELETE_URL "https://api.dropbox.com/1/fileops/delete" 37 #define CREATE_FOLDER_URL "https://api.dropbox.com/1/fileops/create_folder" 38 #define FILE_MOVE_URL "https://api.dropbox.com/1/fileops/move" 39 #define FILE_COPY_URL "https://api.dropbox.com/1/fileops/copy" 40 #define SHARES_URL "https://api.dropbox.com/1/shares" 41 42 #define METADATA_URL "https://api.dropbox.com/1/metadata/dropbox" 43 #define ACCOUNT_URL "https://api.dropbox.com/1/account" 44 #define ACCOUNT_INFO_URL "https://api.dropbox.com/1/account/info" 45 46 class QByteArray; 47 48 class DropRestAPI 49 { 50 public: 51 DropRestAPI(); 52 ~DropRestAPI(); 53 54 QNetworkRequest request_token(); 55 QNetworkRequest request_access_token(); 56 57 QNetworkRequest root_dir(const QString&); 58 59 void oauth_request_token_reply_process(QNetworkReply*); 60 61 QNetworkRequest file_transfer(QString filename, QString dropbox_folder, QString boundaryStr); 62 QNetworkRequest file_transfer_download(QString dropbox_filepath); 63 64 QNetworkRequest __delete(QString dropbox_filepath); 65 QNetworkRequest __create(QString dropbox_filepath); 66 QNetworkRequest __move(QString path_source, QString path_destination); 67 QNetworkRequest __copy(QString path_source, QString path_destination); 68 QNetworkRequest __shares(QString dropbox_filepath); 69 70 QNetworkRequest accountinfo(); 71 72 OAuth *oauth; 73 74 }; 75 76 #endif // DROPRESTAPI_H 77