1
+ // Licensed to Elasticsearch B.V under one or more agreements.
2
+ // Elasticsearch B.V licenses this file to you under the Apache 2.0 License.
3
+ // See the LICENSE file in the project root for more information.
4
+ //
5
+ // ███╗ ██╗ ██████╗ ████████╗██╗ ██████╗███████╗
6
+ // ████╗ ██║██╔═══██╗╚══██╔══╝██║██╔════╝██╔════╝
7
+ // ██╔██╗ ██║██║ ██║ ██║ ██║██║ █████╗
8
+ // ██║╚██╗██║██║ ██║ ██║ ██║██║ ██╔══╝
9
+ // ██║ ╚████║╚██████╔╝ ██║ ██║╚██████╗███████╗
10
+ // ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝╚══════╝
11
+ // ------------------------------------------------
12
+ //
13
+ // This file is automatically generated.
14
+ // Please do not edit these files manually.
15
+ //
16
+ // ------------------------------------------------
17
+
18
+ #nullable restore
19
+
20
+ using System ;
21
+ using System . Linq ;
22
+ using Elastic . Clients . Elasticsearch . Serialization ;
23
+
24
+ namespace Elastic . Clients . Elasticsearch . Inference . Json ;
25
+
26
+ public sealed partial class PutContextualaiRequestConverter : System . Text . Json . Serialization . JsonConverter < Elastic . Clients . Elasticsearch . Inference . PutContextualaiRequest >
27
+ {
28
+ private static readonly System . Text . Json . JsonEncodedText PropChunkingSettings = System . Text . Json . JsonEncodedText . Encode ( "chunking_settings" ) ;
29
+ private static readonly System . Text . Json . JsonEncodedText PropService = System . Text . Json . JsonEncodedText . Encode ( "service" ) ;
30
+ private static readonly System . Text . Json . JsonEncodedText PropServiceSettings = System . Text . Json . JsonEncodedText . Encode ( "service_settings" ) ;
31
+ private static readonly System . Text . Json . JsonEncodedText PropTaskSettings = System . Text . Json . JsonEncodedText . Encode ( "task_settings" ) ;
32
+
33
+ public override Elastic . Clients . Elasticsearch . Inference . PutContextualaiRequest Read ( ref System . Text . Json . Utf8JsonReader reader , System . Type typeToConvert , System . Text . Json . JsonSerializerOptions options )
34
+ {
35
+ reader . ValidateToken ( System . Text . Json . JsonTokenType . StartObject ) ;
36
+ LocalJsonValue < Elastic . Clients . Elasticsearch . Inference . InferenceChunkingSettings ? > propChunkingSettings = default ;
37
+ LocalJsonValue < Elastic . Clients . Elasticsearch . Inference . ContextualAIServiceSettings > propServiceSettings = default ;
38
+ LocalJsonValue < Elastic . Clients . Elasticsearch . Inference . ContextualAITaskSettings ? > propTaskSettings = default ;
39
+ while ( reader . Read ( ) && reader . TokenType is System . Text . Json . JsonTokenType . PropertyName )
40
+ {
41
+ if ( propChunkingSettings . TryReadProperty ( ref reader , options , PropChunkingSettings , null ) )
42
+ {
43
+ continue ;
44
+ }
45
+
46
+ if ( reader . ValueTextEquals ( PropService ) )
47
+ {
48
+ reader . SafeSkip ( ) ;
49
+ continue ;
50
+ }
51
+
52
+ if ( propServiceSettings . TryReadProperty ( ref reader , options , PropServiceSettings , null ) )
53
+ {
54
+ continue ;
55
+ }
56
+
57
+ if ( propTaskSettings . TryReadProperty ( ref reader , options , PropTaskSettings , null ) )
58
+ {
59
+ continue ;
60
+ }
61
+
62
+ if ( options . UnmappedMemberHandling is System . Text . Json . Serialization . JsonUnmappedMemberHandling . Skip )
63
+ {
64
+ reader . SafeSkip ( ) ;
65
+ continue ;
66
+ }
67
+
68
+ throw new System . Text . Json . JsonException ( $ "Unknown JSON property '{ reader . GetString ( ) } ' for type '{ typeToConvert . Name } '.") ;
69
+ }
70
+
71
+ reader . ValidateToken ( System . Text . Json . JsonTokenType . EndObject ) ;
72
+ return new Elastic . Clients . Elasticsearch . Inference . PutContextualaiRequest ( Elastic . Clients . Elasticsearch . Serialization . JsonConstructorSentinel . Instance )
73
+ {
74
+ ChunkingSettings = propChunkingSettings . Value ,
75
+ ServiceSettings = propServiceSettings . Value ,
76
+ TaskSettings = propTaskSettings . Value
77
+ } ;
78
+ }
79
+
80
+ public override void Write ( System . Text . Json . Utf8JsonWriter writer , Elastic . Clients . Elasticsearch . Inference . PutContextualaiRequest value , System . Text . Json . JsonSerializerOptions options )
81
+ {
82
+ writer . WriteStartObject ( ) ;
83
+ writer . WriteProperty ( options , PropChunkingSettings , value . ChunkingSettings , null , null ) ;
84
+ writer . WriteProperty ( options , PropService , value . Service , null , null ) ;
85
+ writer . WriteProperty ( options , PropServiceSettings , value . ServiceSettings , null , null ) ;
86
+ writer . WriteProperty ( options , PropTaskSettings , value . TaskSettings , null , null ) ;
87
+ writer . WriteEndObject ( ) ;
88
+ }
89
+ }
0 commit comments