Ejemplo n.º 1
0
        AudibleQueryBuilder IAudibleQueryBuilder.WithSort(
            AudibleQueryField sortField,
            SortDirection sortDirection)
        {
            if (_sortField != null)
            {
                throw new InvalidOperationException(
                          $"The sortField cannot be set to {sortField.ToString().ToLower().SQuote()} because the " +
                          $"instance of {nameof(AudibleQueryBuilder).SQuote()} already has the sortField " +
                          $"{_sortField.ToString().ToLower().SQuote()}.");
            }

            _sortField = sortField;

            if (_sortDirection != null)
            {
                throw new InvalidOperationException(
                          $"The sortDirection cannot be set to {sortDirection.ToString().ToLower().SQuote()} because the " +
                          $"instance of {nameof(AudibleQueryBuilder).SQuote()} already has the sortDirection " +
                          $"{_sortDirection.ToString().ToLower().SQuote()}.");
            }

            _sortDirection = sortDirection;

            return(this);
        }
Ejemplo n.º 2
0
        AudibleQueryBuilder IAudibleQueryBuilder.WithSearchRank(
            AudibleQueryField searchRankField)
        {
            if (_searchRankField != null)
            {
                throw new InvalidOperationException(
                          $"The searchRankField cannot be set to {searchRankField.ToString().SQuote()} because the " +
                          $"instance of {nameof(AudibleQueryBuilder).SQuote()} already has the searchRankField " +
                          $"{_searchRankField.ToString().ToLower().SQuote()}.");
            }

            _searchRankField = searchRankField;
            return(this);
        }