summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/api/account.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Dropbox/src/api/account.h')
-rw-r--r--plugins/Dropbox/src/api/account.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/Dropbox/src/api/account.h b/plugins/Dropbox/src/api/account.h
new file mode 100644
index 0000000000..4db79622d2
--- /dev/null
+++ b/plugins/Dropbox/src/api/account.h
@@ -0,0 +1,38 @@
+#ifndef _DROPBOX_API_ACCOUNT_H_
+#define _DROPBOX_API_ACCOUNT_H_
+
+class GetAccessTokenRequest : public HttpRequest
+{
+public:
+ GetAccessTokenRequest(const char *requestToken) :
+ HttpRequest(REQUEST_POST, DROPBOX_API_URL "/oauth2/token")
+ {
+ AddBasicAuthHeader(DROPBOX_APP_KEY, DROPBOX_API_SECRET);
+ AddHeader("Content-Type", "application/x-www-form-urlencoded");
+
+ CMStringA data(CMStringDataFormat::FORMAT, "grant_type=authorization_code&code=%s", requestToken);
+ pData = data.GetBuffer();
+ dataLength = data.GetLength();
+ }
+};
+
+class DisableAccessTokenRequest : public HttpRequest
+{
+public:
+ DisableAccessTokenRequest() :
+ HttpRequest(REQUEST_POST, DROPBOX_API_URL "/disable_access_token")
+ {
+ }
+};
+
+class GetAccountInfoRequest : public HttpRequest
+{
+public:
+ GetAccountInfoRequest(const char *token) :
+ HttpRequest(REQUEST_GET, DROPBOX_API_URL "/account/info")
+ {
+ AddBearerAuthHeader(token);
+ }
+};
+
+#endif //_DROPBOX_API_ACCOUNT_H_