diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-05-13 14:29:47 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-05-13 14:29:47 +0000 |
commit | 71846c4e387e27164ffde6b2e8a188b3bc21b2eb (patch) | |
tree | 0651eb829e128942cb0fe361862f93436fdb7a23 /plugins/Dropbox/src/api/account.h | |
parent | f112b278674402d2ea5428307f84de193695a07c (diff) |
Dropbox: refactoring of http requests
git-svn-id: http://svn.miranda-ng.org/main/trunk@13570 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/api/account.h')
-rw-r--r-- | plugins/Dropbox/src/api/account.h | 38 |
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_
|