/
SearchV2Arg.cs
170 lines (150 loc) · 6.33 KB
/
SearchV2Arg.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
// <auto-generated>
// Auto-generated by StoneAPI, do not modify.
// </auto-generated>
namespace Dropbox.Api.Files
{
using sys = System;
using col = System.Collections.Generic;
using re = System.Text.RegularExpressions;
using enc = Dropbox.Api.Stone;
/// <summary>
/// <para>The search v2 arg object</para>
/// </summary>
public class SearchV2Arg
{
#pragma warning disable 108
/// <summary>
/// <para>The encoder instance.</para>
/// </summary>
internal static enc.StructEncoder<SearchV2Arg> Encoder = new SearchV2ArgEncoder();
/// <summary>
/// <para>The decoder instance.</para>
/// </summary>
internal static enc.StructDecoder<SearchV2Arg> Decoder = new SearchV2ArgDecoder();
/// <summary>
/// <para>Initializes a new instance of the <see cref="SearchV2Arg" /> class.</para>
/// </summary>
/// <param name="query">The string to search for. May match across multiple fields
/// based on the request arguments.</param>
/// <param name="options">Options for more targeted search results.</param>
/// <param name="matchFieldOptions">Options for search results match fields.</param>
/// <param name="includeHighlights">Deprecated and moved this option to
/// SearchMatchFieldOptions.</param>
public SearchV2Arg(string query,
SearchOptions options = null,
SearchMatchFieldOptions matchFieldOptions = null,
bool? includeHighlights = null)
{
if (query == null)
{
throw new sys.ArgumentNullException("query");
}
if (query.Length > 1000)
{
throw new sys.ArgumentOutOfRangeException("query", "Length should be at most 1000");
}
this.Query = query;
this.Options = options;
this.MatchFieldOptions = matchFieldOptions;
this.IncludeHighlights = includeHighlights;
}
/// <summary>
/// <para>Initializes a new instance of the <see cref="SearchV2Arg" /> class.</para>
/// </summary>
/// <remarks>This is to construct an instance of the object when
/// deserializing.</remarks>
[sys.ComponentModel.EditorBrowsable(sys.ComponentModel.EditorBrowsableState.Never)]
public SearchV2Arg()
{
}
/// <summary>
/// <para>The string to search for. May match across multiple fields based on the
/// request arguments.</para>
/// </summary>
public string Query { get; protected set; }
/// <summary>
/// <para>Options for more targeted search results.</para>
/// </summary>
public SearchOptions Options { get; protected set; }
/// <summary>
/// <para>Options for search results match fields.</para>
/// </summary>
public SearchMatchFieldOptions MatchFieldOptions { get; protected set; }
/// <summary>
/// <para>Deprecated and moved this option to SearchMatchFieldOptions.</para>
/// </summary>
public bool? IncludeHighlights { get; protected set; }
#region Encoder class
/// <summary>
/// <para>Encoder for <see cref="SearchV2Arg" />.</para>
/// </summary>
private class SearchV2ArgEncoder : enc.StructEncoder<SearchV2Arg>
{
/// <summary>
/// <para>Encode fields of given value.</para>
/// </summary>
/// <param name="value">The value.</param>
/// <param name="writer">The writer.</param>
public override void EncodeFields(SearchV2Arg value, enc.IJsonWriter writer)
{
WriteProperty("query", value.Query, writer, enc.StringEncoder.Instance);
if (value.Options != null)
{
WriteProperty("options", value.Options, writer, global::Dropbox.Api.Files.SearchOptions.Encoder);
}
if (value.MatchFieldOptions != null)
{
WriteProperty("match_field_options", value.MatchFieldOptions, writer, global::Dropbox.Api.Files.SearchMatchFieldOptions.Encoder);
}
if (value.IncludeHighlights != null)
{
WriteProperty("include_highlights", value.IncludeHighlights.Value, writer, enc.BooleanEncoder.Instance);
}
}
}
#endregion
#region Decoder class
/// <summary>
/// <para>Decoder for <see cref="SearchV2Arg" />.</para>
/// </summary>
private class SearchV2ArgDecoder : enc.StructDecoder<SearchV2Arg>
{
/// <summary>
/// <para>Create a new instance of type <see cref="SearchV2Arg" />.</para>
/// </summary>
/// <returns>The struct instance.</returns>
protected override SearchV2Arg Create()
{
return new SearchV2Arg();
}
/// <summary>
/// <para>Set given field.</para>
/// </summary>
/// <param name="value">The field value.</param>
/// <param name="fieldName">The field name.</param>
/// <param name="reader">The json reader.</param>
protected override void SetField(SearchV2Arg value, string fieldName, enc.IJsonReader reader)
{
switch (fieldName)
{
case "query":
value.Query = enc.StringDecoder.Instance.Decode(reader);
break;
case "options":
value.Options = global::Dropbox.Api.Files.SearchOptions.Decoder.Decode(reader);
break;
case "match_field_options":
value.MatchFieldOptions = global::Dropbox.Api.Files.SearchMatchFieldOptions.Decoder.Decode(reader);
break;
case "include_highlights":
value.IncludeHighlights = enc.BooleanDecoder.Instance.Decode(reader);
break;
default:
reader.Skip();
break;
}
}
}
#endregion
}
}