Skip to content

Commit

Permalink
Rename ExcludeParameter to ExcludeElementsParameter
Browse files Browse the repository at this point in the history
  • Loading branch information
zdenekjurka authored and pokornyd committed Mar 6, 2024
1 parent 9149af7 commit 9327b2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions Kontent.Ai.Delivery.Tests/DeliveryClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ public async Task GetLanguagesAsync()
public async Task QueryParameters()
{
_mockHttp.Expect($"{_baseUrl}/items")
.WithExactQueryString("elements.personas%5Ball%5D=barista%2Ccoffee%2Cblogger&elements.personas%5Bany%5D=barista%2Ccoffee%2Cblogger&system.sitemap_locations%5Bcontains%5D=cafes&elements.product_name%5Beq%5D=Hario%20V60&elements.product_name%5Bneq%5D=Hario%20V42&elements.price%5Bgt%5D=1000&elements.price%5Bgte%5D=50&system.type%5Bin%5D=cafe%2Ccoffee&system.type%5Bnin%5D=article%2Cblog_post&elements.price%5Blt%5D=10&elements.price%5Blte%5D=4&elements.country%5Brange%5D=Guatemala%2CNicaragua&elements.price%5Bempty%5D&elements.country%5Bnempty%5D&depth=2&elements=price%2Cproduct_name&exclude=product_description%2Cproduct_thumbnail&limit=10&order=elements.price%5Bdesc%5D&skip=2&language=en&includeTotalCount")
.WithExactQueryString("elements.personas%5Ball%5D=barista%2Ccoffee%2Cblogger&elements.personas%5Bany%5D=barista%2Ccoffee%2Cblogger&system.sitemap_locations%5Bcontains%5D=cafes&elements.product_name%5Beq%5D=Hario%20V60&elements.product_name%5Bneq%5D=Hario%20V42&elements.price%5Bgt%5D=1000&elements.price%5Bgte%5D=50&system.type%5Bin%5D=cafe%2Ccoffee&system.type%5Bnin%5D=article%2Cblog_post&elements.price%5Blt%5D=10&elements.price%5Blte%5D=4&elements.country%5Brange%5D=Guatemala%2CNicaragua&elements.price%5Bempty%5D&elements.country%5Bnempty%5D&depth=2&elements=price%2Cproduct_name&excludeElements=product_description%2Cproduct_thumbnail&limit=10&order=elements.price%5Bdesc%5D&skip=2&language=en&includeTotalCount")
.Respond("application/json", " { 'items': [],'modular_content': {},'pagination': {'skip': 2,'limit': 10,'count': 0, 'total_count': 0, 'next_page': ''}}");

var client = InitializeDeliveryClientWithACustomTypeProvider(_mockHttp);
Expand All @@ -756,7 +756,7 @@ public async Task QueryParameters()
new NotEmptyFilter("elements.country"),
new DepthParameter(2),
new ElementsParameter("price", "product_name"),
new ExcludeParameter("product_description", "product_thumbnail"),
new ExcludeElementsParameter("product_description", "product_thumbnail"),
new LimitParameter(10),
new OrderParameter("elements.price", SortOrder.Descending),
new SkipParameter(2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,18 @@ namespace Kontent.Ai.Urls.Delivery.QueryParameters
/// <summary>
/// Specifies the content elements to exclude from response.
/// </summary>
public sealed class ExcludeParameter : IQueryParameter
public sealed class ExcludeElementsParameter : IQueryParameter
{
/// <summary>
/// Gets the list of codenames of content elements that should be excluded from response.
/// </summary>
public IReadOnlyList<string> ElementCodenames { get; }

/// <summary>
/// Initializes a new instance of the <see cref="ExcludeParameter"/> class using the specified content elements codenames.
/// Initializes a new instance of the <see cref="ExcludeElementsParameter"/> class using the specified content elements codenames.
/// </summary>
/// <param name="elementCodenames">An array that contains zero or more codenames of the content elements that should be excluded from response.</param>
public ExcludeParameter(params string[] elementCodenames)
public ExcludeElementsParameter(params string[] elementCodenames)
{
ElementCodenames = elementCodenames.ToList().AsReadOnly();
}
Expand All @@ -29,7 +29,7 @@ public ExcludeParameter(params string[] elementCodenames)
/// </summary>
public string GetQueryStringParameter()
{
return $"exclude={string.Join(Uri.EscapeDataString(","), ElementCodenames.Select(Uri.EscapeDataString))}";
return $"excludeElements={string.Join(Uri.EscapeDataString(","), ElementCodenames.Select(Uri.EscapeDataString))}";
}
}
}

0 comments on commit 9327b2c

Please sign in to comment.