Esempio n. 1
0
        // Get User
        public IAuthenticatedUser GetAuthenticatedUser(ITwitterCredentials credentials = null, IGetAuthenticatedUserParameters parameters = null)
        {
            IUserDTO userDTO;

            if (credentials == null)
            {
                credentials = _credentialsAccessor.CurrentThreadCredentials;
                userDTO = _userFactoryQueryExecutor.GetAuthenticatedUser(parameters);
            }
            else
            {
                userDTO = _credentialsAccessor.ExecuteOperationWithCredentials(credentials, () =>
                {
                    return _userFactoryQueryExecutor.GetAuthenticatedUser(parameters);
                });
            }

            var authenticatedUser = GenerateAuthenticatedUserFromDTO(userDTO);

            if (authenticatedUser != null)
            {
                authenticatedUser.SetCredentials(credentials);
            }

            return authenticatedUser;
        }
 public void Validate(IGetAuthenticatedUserParameters parameters)
 {
     if (parameters == null)
     {
         throw new ArgumentNullException(nameof(parameters));
     }
 }
Esempio n. 3
0
        public Task <ITwitterResult <IUserDTO> > GetAuthenticatedUser(IGetAuthenticatedUserParameters parameters)
        {
            _validator.Validate(parameters);

            var request = TwitterClient.CreateRequest();

            return(ExecuteRequest(() => _userController.GetAuthenticatedUser(parameters, request), request));
        }
Esempio n. 4
0
        public Task <ITwitterResult <IUserDTO> > GetAuthenticatedUser(IGetAuthenticatedUserParameters parameters, ITwitterRequest request)
        {
            var query = _userQueryGenerator.GetAuthenticatedUserQuery(parameters);

            request.Query.Url        = query;
            request.Query.HttpMethod = HttpMethod.GET;

            return(_twitterAccessor.ExecuteRequest <IUserDTO>(request));
        }
Esempio n. 5
0
        public string GetAuthenticatedUserQuery(IGetAuthenticatedUserParameters parameters)
        {
            var query = new StringBuilder(Resources.User_GetCurrentUser);

            query.AddParameterToQuery("skip_status", parameters.SkipStatus);
            query.AddParameterToQuery("include_entities", parameters.IncludeEntities);
            query.AddParameterToQuery("include_email", parameters.IncludeEmail);
            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
        public string GetAuthenticatedUserQuery(IGetAuthenticatedUserParameters parameters)
        {
            var query = new StringBuilder(Resources.User_GetCurrentUser);
            parameters = parameters ?? new GetAuthenticatedUserParameters();

            query.AddParameterToQuery("skip_status", parameters.SkipStatus);
            query.AddParameterToQuery("include_entities", parameters.IncludeEntities);
            query.AddParameterToQuery("include_email", parameters.IncludeEmail);
            query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters));

            return query.ToString();
        }
        public string GetAuthenticatedUserQuery(IGetAuthenticatedUserParameters parameters)
        {
            var query = new StringBuilder(Resources.User_GetCurrentUser);

            parameters = parameters ?? new GetAuthenticatedUserParameters();

            query.AddParameterToQuery("skip_status", parameters.SkipStatus);
            query.AddParameterToQuery("include_entities", parameters.IncludeEntities);
            query.AddParameterToQuery("include_email", parameters.IncludeEmail);
            query.Append(_queryParameterGenerator.GenerateAdditionalRequestParameters(parameters.FormattedCustomQueryParameters));

            return(query.ToString());
        }
Esempio n. 8
0
 public void Validate(IGetAuthenticatedUserParameters parameters)
 {
     _usersClientParametersValidator.Validate(parameters);
 }
Esempio n. 9
0
        public async Task <IAuthenticatedUser> GetAuthenticatedUser(IGetAuthenticatedUserParameters parameters)
        {
            var requestResult = await _usersRequester.GetAuthenticatedUser(parameters).ConfigureAwait(false);

            return(_client.Factories.CreateAuthenticatedUser(requestResult?.DataTransferObject));
        }
Esempio n. 10
0
 // Get single user
 public IUserDTO GetAuthenticatedUser(IGetAuthenticatedUserParameters parameters)
 {
     var query = _userQueryParameterGenerator.GetAuthenticatedUserQuery(parameters);
     return _twitterAccessor.ExecuteGETQuery<IUserDTO>(query);
 }
Esempio n. 11
0
 public static IAuthenticatedUser GetAuthenticatedUser(ITwitterCredentials credentials = null, IGetAuthenticatedUserParameters parameters = null)
 {
     return UserFactory.GetAuthenticatedUser(credentials, parameters);
 }
        // Get single user
        public IUserDTO GetAuthenticatedUser(IGetAuthenticatedUserParameters parameters)
        {
            var query = _userQueryParameterGenerator.GetAuthenticatedUserQuery(parameters);

            return(_twitterAccessor.ExecuteGETQuery <IUserDTO>(query));
        }
Esempio n. 13
0
        // Get User
        public IAuthenticatedUser GetAuthenticatedUser(ITwitterCredentials credentials = null, IGetAuthenticatedUserParameters parameters = null)
        {
            IUserDTO userDTO;

            if (credentials == null)
            {
                credentials = _credentialsAccessor.CurrentThreadCredentials;
                userDTO     = _userFactoryQueryExecutor.GetAuthenticatedUser(parameters);
            }
            else
            {
                userDTO = _credentialsAccessor.ExecuteOperationWithCredentials(credentials, () =>
                {
                    return(_userFactoryQueryExecutor.GetAuthenticatedUser(parameters));
                });
            }

            var authenticatedUser = GenerateAuthenticatedUserFromDTO(userDTO);

            if (authenticatedUser != null)
            {
                authenticatedUser.SetCredentials(credentials);
            }

            return(authenticatedUser);
        }
Esempio n. 14
0
 public Task <ITwitterResult <IUserDTO> > GetAuthenticatedUser(IGetAuthenticatedUserParameters parameters, ITwitterRequest request)
 {
     return(_userQueryExecutor.GetAuthenticatedUser(parameters, request));
 }
Esempio n. 15
0
 /// <summary>
 /// Get the authenticated user based on the application credentials or given parameter credentials.
 /// </summary>
 public static IAuthenticatedUser GetAuthenticatedUser(ITwitterCredentials credentials = null, IGetAuthenticatedUserParameters parameters = null)
 {
     return(UserFactory.GetAuthenticatedUser(credentials, parameters));
 }
Esempio n. 16
0
 public GetAuthenticatedUserParameters(IGetAuthenticatedUserParameters parameters) : base(parameters)
 {
     IncludeEmail = parameters?.IncludeEmail;
 }