blob: 4db79622d23e620ffbf4a6f10047461bdd89c6b3 (
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_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_
|