forked from DropNet/DropNet
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUser.Sync.cs
More file actions
44 lines (33 loc) · 1.25 KB
/
Copy pathUser.Sync.cs
File metadata and controls
44 lines (33 loc) · 1.25 KB
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
39
40
41
42
43
44
#if WINDOWS_PHONE
//Exclude
#else
using DropNet.Models;
using RestSharp;
using DropNet.Authenticators;
using System.Net;
using DropNet.Helpers;
namespace DropNet
{
public partial class DropNetClient
{
public UserLogin Login(string email, string password)
{
_restClient.BaseUrl = Resource.SecureLoginBaseUrl;
_restClient.Authenticator = new OAuthAuthenticator(_restClient.BaseUrl, _apiKey, _appsecret, null, null);
var request = _requestHelper.CreateLoginRequest(_apiKey, email, password);
var response = _restClient.Execute<UserLogin>(request);
_userLogin = response.Data;
return _userLogin;
}
public AccountInfo Account_Info()
{
//This has to be here as Dropbox change their base URL between calls
_restClient.BaseUrl = Resource.ApiBaseUrl;
_restClient.Authenticator = new OAuthAuthenticator(_restClient.BaseUrl, _apiKey, _appsecret, _userLogin.Token, _userLogin.Secret);
var request = _requestHelper.CreateAccountInfoRequest();
var response = _restClient.Execute<AccountInfo>(request);
return response.Data;
}
}
}
#endif