public void Validate(ICheckIfUserIsMemberOfListParameters parameters) { if (parameters == null) { throw new ArgumentNullException(nameof(parameters)); } ThrowIfListIdentifierIsNotValid(parameters.List); _userQueryValidator.ThrowIfUserCannotBeIdentified(parameters.User); }
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()); }
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; } }
public void Validate(ICheckIfUserIsMemberOfListParameters parameters) { _twitterListsClientParametersValidator.Validate(parameters); }
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)); }
public Task <ITwitterResult <ITwitterListDTO> > CheckIfUserIsAListMember(ICheckIfUserIsMemberOfListParameters parameters) { _validator.Validate(parameters); return(ExecuteRequest(request => _twitterListController.CheckIfUserIsAListMember(parameters, request))); }
public Task <ITwitterResult <ITwitterListDTO> > CheckIfUserIsAListMemberAsync(ICheckIfUserIsMemberOfListParameters parameters, ITwitterRequest request) { return(_twitterListQueryExecutor.CheckIfUserIsAListMemberAsync(parameters, request)); }