diff options
Diffstat (limited to 'plugins/Dropbox/src/api/operations.h')
-rw-r--r-- | plugins/Dropbox/src/api/operations.h | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/plugins/Dropbox/src/api/operations.h b/plugins/Dropbox/src/api/operations.h new file mode 100644 index 0000000000..1ff7d50230 --- /dev/null +++ b/plugins/Dropbox/src/api/operations.h @@ -0,0 +1,60 @@ +#ifndef _DROPBOX_API_OPERATIONS_H_
+#define _DROPBOX_API_OPERATIONS_H_
+
+class ShareRequest : public HttpRequest
+{
+public:
+ ShareRequest(const char *token, const char *path, bool useShortUrl = true) :
+ HttpRequest(REQUEST_POST, FORMAT, DROPBOX_API_URL "/shares/auto/%s", path)
+ {
+ if (!useShortUrl)
+ AddUrlParameter("short_url=false");
+
+ AddBearerAuthHeader(token);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+ }
+};
+
+class DeleteRequest : public HttpRequest
+{
+public:
+ DeleteRequest(const char *token, const char *path) :
+ HttpRequest(REQUEST_POST, DROPBOX_API_URL "/fileops/delete")
+ {
+ AddBearerAuthHeader(token);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+
+ CMStringA data(CMStringDataFormat::FORMAT, "root=auto&path=%s", path);
+ data.Replace('\\', '/');
+ pData = data.GetBuffer();
+ dataLength = data.GetLength();
+ }
+};
+
+class CreateFolderRequest : public HttpRequest
+{
+public:
+ CreateFolderRequest(const char *token, const char *path) :
+ HttpRequest(REQUEST_POST, DROPBOX_API_URL "/fileops/create_folder")
+ {
+ AddBearerAuthHeader(token);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+
+ CMStringA data(CMStringDataFormat::FORMAT, "root=auto&path=%s", path);
+ data.Replace('\\', '/');
+ pData = data.GetBuffer();
+ dataLength = data.GetLength();
+ }
+};
+
+class GetMetadataRequest : public HttpRequest
+{
+public:
+ GetMetadataRequest(const char *token, const char *path) :
+ HttpRequest(REQUEST_GET, FORMAT, DROPBOX_API_URL "/metadata/auto/%s", path)
+ {
+ AddBearerAuthHeader(token);
+ }
+};
+
+#endif //_DROPBOX_API_OPERATIONS_H_
|