Skip to content

Commit c4acbe8

Browse files
Merge #557
557: Fixed missing TaskInfoStatus and TaskInfoType handling in ObjectExtensions r=ahmednfwela a=postmeback # Pull Request ## Related issue Fixes #509 ## What does this PR do? - Adds 4 lines of code to include **TaskInfoStatus** and **TaskInfoType** in the respective function. ## PR checklist Please check if your PR fulfills the following requirements: - [x] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [x] Have you read the contributing guidelines? - [x] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! ![image](https://github.com/user-attachments/assets/dac1395b-210b-41b0-8205-1a12ef17ba4b) Tests and formatted ran successfully Co-authored-by: postmeback <[email protected]> Co-authored-by: Arka Poddar <[email protected]>
2 parents 6687dfd + eb6c310 commit c4acbe8

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

src/Meilisearch/Extensions/ObjectExtensions.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ internal static string ToQueryString(this object source, BindingFlags bindingAtt
5656
{
5757
values.Add(key + "=" + string.Join(",", (List<int>)value));
5858
}
59+
else if (itemType == typeof(TaskInfoStatus))
60+
{
61+
values.Add(key + "=" + string.Join(",", ((List<TaskInfoStatus>)value).Select(x => x.ToString())));
62+
}
63+
else if (itemType == typeof(TaskInfoType))
64+
{
65+
values.Add(key + "=" + string.Join(",", ((List<TaskInfoType>)value).Select(x => x.ToString())));
66+
}
5967
}
6068
else if (value is DateTime)
6169
{

tests/Meilisearch.Tests/ObjectExtensionsTests.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Linq;
4+
using System.Text.Json.Serialization;
45

6+
using Meilisearch.Converters;
57
using Meilisearch.Extensions;
68
using Meilisearch.QueryParameters;
79

@@ -17,6 +19,8 @@ public class FakeQuery
1719
public string FakeString { get; set; }
1820
public int? FakeInteger { get; set; }
1921
public List<string> FakeStringList { get; set; }
22+
public List<TaskInfoStatus> FakeStatusList { get; set; }
23+
public List<TaskInfoType> FakeTypeList { get; set; }
2024
public string Path { get; set; }
2125
}
2226

@@ -40,6 +44,21 @@ public static IEnumerable<object[]> FakeData()
4044
new FakeQuery { FakeDate = date, FakeStringList = new List<string> { "hey", "ho" } },
4145
$"fakeDate={Uri.EscapeDataString(date.ToString("yyyy-MM-dd'T'HH:mm:ss.fffzzz"))}&fakeStringList=hey,ho"
4246
};
47+
48+
yield return new object[] {
49+
new FakeQuery { FakeStatusList = new List<TaskInfoStatus> { TaskInfoStatus.Enqueued, TaskInfoStatus.Succeeded } },
50+
"fakeStatusList=Enqueued,Succeeded"
51+
};
52+
53+
yield return new object[] {
54+
new FakeQuery { FakeTypeList = new List<TaskInfoType> { TaskInfoType.IndexCreation, TaskInfoType.DocumentDeletion } },
55+
"fakeTypeList=IndexCreation,DocumentDeletion"
56+
};
57+
58+
yield return new object[] {
59+
new FakeQuery { FakeStatusList = new List<TaskInfoStatus> { TaskInfoStatus.Processing }, FakeTypeList = new List<TaskInfoType> { TaskInfoType.SettingsUpdate } },
60+
"fakeStatusList=Processing&fakeTypeList=SettingsUpdate"
61+
};
4362
}
4463

4564
[Theory]

0 commit comments

Comments
 (0)