blob: 6943bd29c3f4b2351fa3de00a050500a66153cca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 "/oauth2/token")
{
AddHeader("Content-Type", "application/x-www-form-urlencoded");
CMStringA data(CMStringDataFormat::FORMAT,
"client_id=%s&client_secret=%s&grant_type=authorization_code&code=%s",
DROPBOX_APP_KEY, DROPBOX_API_SECRET, requestToken);
SetData(data.GetBuffer(), data.GetLength());
}
};
class RevokeAccessTokenRequest : public HttpRequest
{
public:
RevokeAccessTokenRequest() :
HttpRequest(REQUEST_POST, DROPBOX_API "/oauth2/token/revoke")
{
}
};
class GetCurrentAccountRequest : public HttpRequest
{
public:
GetCurrentAccountRequest(const char *token) :
HttpRequest(REQUEST_POST, DROPBOX_API_RPC "/users/get_current_account")
{
AddBearerAuthHeader(token);
}
};
#endif //_DROPBOX_API_ACCOUNT_H_
|