-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathCategorySuggestDescriptor.cs
47 lines (41 loc) · 1.04 KB
/
CategorySuggestDescriptor.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace Nest
{
public interface ICategorySuggestContext : ISuggestContext
{
[JsonProperty("default")]
IEnumerable<string> Default { get; set; }
}
[JsonObject]
public class CategorySuggestContext : ICategorySuggestContext
{
public string Type { get { return "category"; } }
public PropertyPathMarker Path { get; set; }
public IEnumerable<string> Default { get; set; }
}
public class CategorySuggestDescriptor<T>
where T : class
{
internal CategorySuggestContext _Context = new CategorySuggestContext();
public CategorySuggestDescriptor<T> Path(string path)
{
this._Context.Path = path;
return this;
}
public CategorySuggestDescriptor<T> Path(Expression<Func<T, object>> objectPath)
{
this._Context.Path = objectPath;
return this;
}
public CategorySuggestDescriptor<T> Default(params string[] defaults)
{
this._Context.Default = defaults;
return this;
}
}
}