public void Validate(ICheckIfUserIsMemberOfListParameters parameters)
        {
            if (parameters == null)
            {
                throw new ArgumentNullException(nameof(parameters));
            }

            ThrowIfListIdentifierIsNotValid(parameters.List);
            _userQueryValidator.ThrowIfUserCannotBeIdentified(parameters.User);
        }
コード例 #2
0
        public string GetCheckIfUserIsMemberOfListQuery(ICheckIfUserIsMemberOfListParameters parameters)
        {
            var query = new StringBuilder(Resources.List_CheckMembership);

            _twitterListQueryParameterGenerator.AppendListIdentifierParameter(query, parameters);
            _userQueryParameterGenerator.AppendUser(query, parameters.User);

            query.AddParameterToQuery("include_entities", parameters.IncludeEntities);
            query.AddParameterToQuery("skip_status", parameters.SkipStatus);

            query.AddFormattedParameterToQuery(parameters.FormattedCustomQueryParameters);

            return(query.ToString());
        }
コード例 #3
0
        public async Task <bool> CheckIfUserIsMemberOfListAsync(ICheckIfUserIsMemberOfListParameters parameters)
        {
            try
            {
                await _twitterListsRequester.CheckIfUserIsAListMemberAsync(parameters).ConfigureAwait(false);

                return(true);
            }
            catch (TwitterException e)
            {
                if (e.StatusCode == 404)
                {
                    // This is a special case where the request actually throws expectedly
                    // When a user is not a member of a list this operation returns a 404.
                    return(false);
                }

                throw;
            }
        }
コード例 #4
0
 public void Validate(ICheckIfUserIsMemberOfListParameters parameters)
 {
     _twitterListsClientParametersValidator.Validate(parameters);
 }
コード例 #5
0
 public Task <ITwitterResult <ITwitterListDTO> > CheckIfUserIsAListMemberAsync(ICheckIfUserIsMemberOfListParameters parameters, ITwitterRequest request)
 {
     request.Query.Url        = _listsQueryGenerator.GetCheckIfUserIsMemberOfListQuery(parameters);
     request.Query.HttpMethod = HttpMethod.GET;
     return(_twitterAccessor.ExecuteRequestAsync <ITwitterListDTO>(request));
 }
コード例 #6
0
 public Task <ITwitterResult <ITwitterListDTO> > CheckIfUserIsAListMember(ICheckIfUserIsMemberOfListParameters parameters)
 {
     _validator.Validate(parameters);
     return(ExecuteRequest(request => _twitterListController.CheckIfUserIsAListMember(parameters, request)));
 }
コード例 #7
0
 public Task <ITwitterResult <ITwitterListDTO> > CheckIfUserIsAListMemberAsync(ICheckIfUserIsMemberOfListParameters parameters, ITwitterRequest request)
 {
     return(_twitterListQueryExecutor.CheckIfUserIsAListMemberAsync(parameters, request));
 }