1
+ using Unions ;
2
+ using System . Text . Json . Serialization ;
3
+ using System ;
4
+ using System . Collections . ObjectModel ;
5
+ using System . Collections . Generic ;
6
+ using System . Text . Json ;
7
+
8
+ namespace Box . Sdk . Gen . Schemas {
9
+ [ JsonConverter ( typeof ( EventSourceOrFileOrFolderOrGenericSourceOrUserConverter ) ) ]
10
+ public class EventSourceOrFileOrFolderOrGenericSourceOrUser : OneOf < EventSource , File , Folder , Dictionary < string , string > , User > {
11
+ public EventSource ? EventSource => _val0 ;
12
+
13
+ public File ? File => _val1 ;
14
+
15
+ public Folder ? Folder => _val2 ;
16
+
17
+ public Dictionary < string , string > ? GenericSource => _val3 ;
18
+
19
+ public User ? User => _val4 ;
20
+
21
+ public EventSourceOrFileOrFolderOrGenericSourceOrUser ( EventSource value ) : base ( value ) { }
22
+
23
+ public EventSourceOrFileOrFolderOrGenericSourceOrUser ( File value ) : base ( value ) { }
24
+
25
+ public EventSourceOrFileOrFolderOrGenericSourceOrUser ( Folder value ) : base ( value ) { }
26
+
27
+ public EventSourceOrFileOrFolderOrGenericSourceOrUser ( Dictionary < string , string > value ) : base ( value ) { }
28
+
29
+ public EventSourceOrFileOrFolderOrGenericSourceOrUser ( User value ) : base ( value ) { }
30
+
31
+ public static implicit operator EventSourceOrFileOrFolderOrGenericSourceOrUser ( EventSource value ) => new EventSourceOrFileOrFolderOrGenericSourceOrUser ( value ) ;
32
+
33
+ public static implicit operator EventSourceOrFileOrFolderOrGenericSourceOrUser ( File value ) => new EventSourceOrFileOrFolderOrGenericSourceOrUser ( value ) ;
34
+
35
+ public static implicit operator EventSourceOrFileOrFolderOrGenericSourceOrUser ( Folder value ) => new EventSourceOrFileOrFolderOrGenericSourceOrUser ( value ) ;
36
+
37
+ public static implicit operator EventSourceOrFileOrFolderOrGenericSourceOrUser ( Dictionary < string , string > value ) => new EventSourceOrFileOrFolderOrGenericSourceOrUser ( value ) ;
38
+
39
+ public static implicit operator EventSourceOrFileOrFolderOrGenericSourceOrUser ( User value ) => new EventSourceOrFileOrFolderOrGenericSourceOrUser ( value ) ;
40
+
41
+ class EventSourceOrFileOrFolderOrGenericSourceOrUserConverter : JsonConverter < EventSourceOrFileOrFolderOrGenericSourceOrUser > {
42
+ public override EventSourceOrFileOrFolderOrGenericSourceOrUser Read ( ref Utf8JsonReader reader , Type typeToConvert , JsonSerializerOptions options ) {
43
+ using var document = JsonDocument . ParseValue ( ref reader ) ;
44
+ throw new Exception ( $ "Discriminant not found in json payload { document . RootElement } while try to converting to type { typeToConvert } ") ;
45
+ }
46
+
47
+ public override void Write ( Utf8JsonWriter writer , EventSourceOrFileOrFolderOrGenericSourceOrUser ? value , JsonSerializerOptions options ) {
48
+ }
49
+
50
+ }
51
+
52
+ }
53
+ }
0 commit comments