Skip to content

Commit

Permalink
Add collation.
Browse files Browse the repository at this point in the history
  • Loading branch information
SebastianStehle committed Nov 15, 2024
1 parent aa23fd0 commit 96721d2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion csharp/Squidex.ClientLibrary/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<PackageTags>Squidex HeadlessCMS</PackageTags>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>20.0.0</Version>
<Version>20.1.0</Version>
</PropertyGroup>

<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,26 @@ public void ContentQuery_with_search_and_filter()
Assert.Equal("?$filter=my-filter&$search=\"my-search\"", query);
}

[Fact]
public void ContentQuery_with_random()
{
var query = new ContentQuery { Random = 42 }
.ToQuery(true, options)
.ToString();

Assert.Equal("?random=42", query);
}

[Fact]
public void ContentQuery_with_collation()
{
var query = new ContentQuery { Collation = "tr" }
.ToQuery(true, options)
.ToString();

Assert.Equal("?collation=tr", query);
}

[Fact]
public void ContentQuery_with_ids()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ public class ContentQuery
/// </value>
public string? Search { get; set; }

/// <summary>
/// The locale that is used to compare strings.
/// </summary>
public string? Collation { get; set; }

/// <summary>
/// Pick a random number of elements from the result set.
/// </summary>
Expand All @@ -103,6 +108,7 @@ internal Query ToQuery(bool supportsSearch, SquidexOptions options)
q.Append("$top", Top);
q.Append("$orderby", OrderBy);
q.Append("$filter", Filter);
q.Append("collation", Collation);
q.Append("random", Random);
q.AppendMany("ids", Ids);

Expand Down

0 comments on commit 96721d2

Please sign in to comment.