Пример #1
0
        private OneDriveClient(AccessTokenData token)
        {
            if (token == null)
                throw new ArgumentNullException("token");

            _client = new RestClient
            {
                UserAgent = "7Pass",
                BaseUrl = "https://apis.live.net/v5.0/",
            };

            SetToken(token);
        }
Пример #2
0
        private OneDriveClient(AccessTokenData token)
        {
            if (token == null)
            {
                throw new ArgumentNullException("token");
            }

            _client = new RestClient
            {
                UserAgent = "8Pass",
                BaseUrl   = "https://apis.live.net/v5.0/",
            };

            SetToken(token);
        }
Пример #3
0
        private void SetToken(AccessTokenData token)
        {
            _token = token;

            var tokenPar = _client.DefaultParameters
                           .FirstOrDefault(x => x.Name == "token");

            if (tokenPar != null)
            {
                tokenPar.Value = token.access_token;
            }
            else
            {
                _client.AddDefaultParameter("token",
                                            token.access_token,
                                            ParameterType.UrlSegment);
            }
        }
Пример #4
0
        private void SetToken(AccessTokenData token)
        {
            _token = token;

            var tokenPar = _client.DefaultParameters
                .FirstOrDefault(x => x.Name == "token");

            if (tokenPar != null)
                tokenPar.Value = token.access_token;
            else
            {
                _client.AddDefaultParameter("token",
                    token.access_token,
                    ParameterType.UrlSegment);
            }
        }